oracle工具之nid命令的使用
一 命令解釋
[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
本文出自 “myblog” 部落格,http://jiujian.blog.51cto.com/444665/1336559
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29119536/viewspace-1270700/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DBNEWID的用法----NID命令
- 使用NID修改Oracle資料庫名Oracle資料庫
- oracle nid修改dbnameOracle
- 【原創】使用nid命令修改資料庫名稱資料庫
- Oracle NID工具修改資料庫DBID和資料庫名稱Oracle資料庫
- [轉] 使用NID 修改資料庫名(Oracle9或以上)資料庫Oracle
- 【工具使用】常用的SQLMAP命令SQL
- 我使用過的Linux命令之sftp - 安全檔案傳輸命令列工具LinuxFTP命令列
- EFCore之命令列工具命令列
- 利用nid工具修改db_name時hang住
- Oracle redo解析之-2、BBED & DUMP工具使用Oracle Redo
- Oracle rac使用nid和dbms_backup_restore包修改dbid和dbnameOracleREST
- Oracle bbed工具的使用Oracle
- 管理Oracle RAC工具及命令Oracle
- 使用SVN命令列工具命令列
- Oracle ASM AMDU工具的使用OracleASM
- 利用nid工具修改db_name和instance_name
- 轉載-oracle Shrink命令的使用Oracle
- Oracle工具篇之TkprofOracle
- JVM 調優命令&工具使用JVM
- Laravel Artisan 命令工具使用技巧Laravel
- Oracle CSSCAN工具使用OracleCSS
- oracle set 使用命令Oracle
- Oracle中使用unix命令Oracle
- CUUG ORACLE高階工具的使用Oracle
- Oracle RAC 常用維護工具和命令Oracle
- oracle之logminer的使用Oracle
- keytool工具使用命令
- zt Oracle工具篇之TkprofOracle
- Oracle工具篇之OradbaOracle
- oracle11gRAC之crsctl命令Oracle
- oracle之 oradebug 命令用法Oracle
- oracle11gRAC之srvctl命令:Oracle
- oracle Export/Import工具使用OracleExportImport
- Oracle statspack工具使用解析Oracle
- ORACLE EXPDP命令使用詳細Oracle
- 使用命令啟動OracleOracle
- iOS逆向之工具使用iOS