日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle11g nid,Oracle工具之nid命令的使用

發布時間:2023/12/19 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle11g nid,Oracle工具之nid命令的使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

當我們手動copy了整個數據庫,并通過重建控制文件給數據庫指定了新的dbname,但是卻不能給數據庫分配新的dbid.對于以上問題我們可以通過nid命令來對數據庫分配一個全新的dbid。同時需要注意rman也是通過dbid來區分數據庫。

一 命令解釋

[Oracle@source ~]$ nid help=yes

DBNEWID: Release 11.2.0.2.0 - Production on Thu Dec 5 00:09:50 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Keyword Description (Default)

----------------------------------------------------

TARGET Username/Password (NONE) 指定連接數據庫的用戶名和密碼

DBNAME New database name (NONE) DBNAME=new_db_name 改變數據庫的名字

LOGFILE Output Log (NONE) LOGFILE=logfile指定輸出消息到指定的日志文件,默認nid覆蓋之前的日子文件

REVERT Revert failed change NO 指定yes表明更改dbid失敗時能夠恢復之前的狀態

SETNAME Set a new database name only NO 指定yes表明僅僅更改數據庫db_name

APPEND Append to output log NO 指定yes標識輸出追加到已經存在的日志文件

HELP Displays these messages NO 指定yes顯示幫助信息

注意:可以同時更改數據庫的dbid和db_name,也可以僅改變數據庫的db_name、抑或僅更改數據庫的dbid。語法分別如下:

改變dbid和db_name : nid target=sys/dhhzdhhz dbname=crm_test (也可以target=/)

僅改變db_name: nid target=sys/dhhzdhhz dbname=crm_test setname=yes (也可以target=/)

僅更改dbid: nid target=sys/dhhzdhhz (也可以target=/)

二 使用nid的注意事項

1 確保有能夠對數據庫進行完全恢復的備份。

2 確保執行更改dbid操作時數據庫處于mounted狀態且mounted之前數據庫是經過shutdown immediate關閉的。

3 使用nid更改數據庫的dbid后,數據庫需要alter database open resetlogs啟動,啟動之后須對數據庫進行一次全備份,因為之前的備份和歸檔已經不能再使用了。

4 使用nid更改數據庫dbname后,需更改初始化參數文件中的DB_NAME參數并重建密碼文件。

5 使用nid不能更改全局數據庫名。

6 確保所有數據文件處于online狀態且不需要恢復。

7 盡量確保oracle沒有離線的數據文件和只讀表空間,如果有使其正常化。

三 舉兩個例子

eg1:僅更改數據庫dbid

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1252663296 bytes

Fixed Size 2226072 bytes

Variable Size 922749032 bytes

Database Buffers 318767104 bytes

Redo Buffers 8921088 bytes

Database mounted.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@source ~]$ nid target=sys

DBNEWID: Release 11.2.0.2.0 - Production on Wed Dec 4 23:39:11 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Password:

Connected to database CRM (DBID=3599153036)

Connected to server version 11.2.0

Control Files in database:

/oracle/CRM/control03.ctl

Change database ID of database CRM? (Y/[N]) => y

Proceeding with operation

Changing database ID from 3599153036 to 3641774948

Control File /oracle/CRM/control03.ctl - modified

Datafile /oracle/CRM/system01.db - dbid changed

Datafile /oracle/CRM/sysaux01.db - dbid changed

Datafile /oracle/CRM/zx.db - dbid changed

Datafile /oracle/CRM/users01.db - dbid changed

Datafile /oracle/CRM/pos.db - dbid changed

Datafile /oracle/CRM/erp.db - dbid changed

Datafile /oracle/CRM/user01.db - dbid changed

Datafile /oracle/CRM/undotbs03.db - dbid changed

Datafile /oracle/CRM/crm.db - dbid changed

Datafile /oracle/CRM/jxc.db - dbid changed

Datafile /oracle/CRM/temp01.db - dbid changed

Control File /oracle/CRM/control03.ctl - dbid changed

Instance shut down

Database ID for database CRM changed to 3641774948.

All previous backups and archived redo logs for this database are unusable.

Database has been shutdown, open database with RESETLOGS option.

Succesfully changed database ID.

DBNEWID - Completed succesfully.

[oracle@source ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Dec 4 23:47:21 2013

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1252663296 bytes

Fixed Size 2226072 bytes

Variable Size 922749032 bytes

Database Buffers 318767104 bytes

Redo Buffers 8921088 bytes

Database mounted.

SQL> alter database open resetlogs;

Database altered.

SQL> select dbid,name from v$database;

DBID NAME

---------- ---------

3641774948 CRM

eg2 :僅更改數據庫db_name

oracle@source ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 5 00:11:03 2013

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select open_mode from v$database;

OPEN_MODE

--------------------

READ WRITE

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1252663296 bytes

Fixed Size 2226072 bytes

Variable Size 905971816 bytes

Database Buffers 335544320 bytes

Redo Buffers 8921088 bytes

Database mounted.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

oracle@source ~]$ nid target=sys dbname=CRM_TEST setname=YES

DBNEWID: Release 11.2.0.2.0 - Production on Thu Dec 5 00:24:58 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Password:

Connected to database CRM (DBID=3641774948)

Connected to server version 11.2.0

Control Files in database:

/oracle/CRM/control03.ctl

Change database name of database CRM to CRM_TEST? (Y/[N]) => y

Proceeding with operation

Changing database name from CRM to CRM_TEST

Control File /oracle/CRM/control03.ctl - modified

Datafile /oracle/CRM/system01.db - wrote new name

Datafile /oracle/CRM/sysaux01.db - wrote new name

Datafile /oracle/CRM/zx.db - wrote new name

Datafile /oracle/CRM/users01.db - wrote new name

Datafile /oracle/CRM/pos.db - wrote new name

Datafile /oracle/CRM/erp.db - wrote new name

Datafile /oracle/CRM/user01.db - wrote new name

Datafile /oracle/CRM/undotbs03.db - wrote new name

Datafile /oracle/CRM/crm.db - wrote new name

Datafile /oracle/CRM/jxc.db - wrote new name

Datafile /oracle/CRM/temp01.db - wrote new name

Control File /oracle/CRM/control03.ctl - wrote new name

Instance shut down

Database name changed to CRM_TEST.

Modify parameter file and generate a new password file before restarting.

Succesfully changed database name.

DBNEWID - Completed succesfully.

[oracle@source ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 5 00:25:33 2013

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount;

ORACLE instance started.

Total System Global Area 1252663296 bytes

Fixed Size 2226072 bytes

Variable Size 905971816 bytes

Database Buffers 335544320 bytes

Redo Buffers 8921088 bytes

SQL> alter system set db_name=CRM_TEST scope=spfile;

System altered.

[oracle@source ~]$orapwd file="$ORACLE_HOME/dbs/orapw$ORACLE_SID" password=dhhzdhhz force=y

[oracle@source dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 5 00:34:40 2013

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup force open;

ORACLE instance started.

Total System Global Area 1252663296 bytes

Fixed Size 2226072 bytes

Variable Size 905971816 bytes

Database Buffers 335544320 bytes

Redo Buffers 8921088 bytes

Database mounted.

Database opened.

SQL> select dbid,name from v$database;

DBID NAME

---------- ---------

3641774948 CRM_TEST

總結

以上是生活随笔為你收集整理的oracle11g nid,Oracle工具之nid命令的使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。