改oracle的name和dbid

来源:互联网 发布:上门修手机 知乎 编辑:程序博客网 时间:2024/05/22 13:24

改oracle的name和dbid

-- 我们可以使用NID 命令只修改DBNAME, 或者只修改DBID,或者2个都修改。

--本文不修改 instance_name


他们的区别如下:

  1.If you change the DBID you must open the database with the RESETLOGS  option,which re-creates the online redo logs and resets their sequence to 1.

-- 修改DBID,必须要用resetlogs 打开数据库。这个在之前的DBID 的介绍里说过,因为DBID 存在与数据文件,redo log 和控制文件。所以如果修改了DBID,则必须要使用resetlogs打开。

  2. If you change the DBNAME without changing the DBID then this does not     require you to open with the RESETLOGS option, so database backups and     archived logs are not invalidated.  You must change the DB_NAME initialization     parameter after a database name change to reflect the new name.  Also, you may have to re-create the Oracle password file.  If you restore an old backup of the control file (before the name change, then you should use the initialization parameter file and password file from before the database name change.

具体步骤如下:

SQL>
SQL>select name,dbid,db_unique_name from v$database;

NAME                     DBID DB_UNIQUE_NAME
------------------ ---------- ------------------------------------------------------------
PROD9              4167122059 PROD9

SQL>select instance_name from v$instance;

INSTANCE_NAME
--------------------------------
PROD9

SQL>
SQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL>startup mount;
ORACLE instance started.

Total System Global Area 5.3687E+10 bytes
Fixed Size                  2239008 bytes
Variable Size            1480119776 bytes
Database Buffers         5.2194E+10 bytes
Redo Buffers               10813440 bytes
Database mounted.
SQL>
SQL>
SQL>exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
     
bash-3.2$nid

DBNEWID: Release 10.2.0.4.0 - Production on Mon May 21 10:31:35 2012

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

Keyword     Description                    (Default)
----------------------------------------------------
TARGET      Username/Password              (NONE)
DBNAME      New database name              (NONE)
LOGFILE     Output Log                     (NONE)
REVERT      Revert failed change           NO
SETNAME     Set a new database name only   NO
APPEND      Append to output log           NO
HELP        Displays these messages        NO

bash-3.2$
bash-3.2$nid target=/ dbname=rac         #注意:这里的rac指的是新的dbname

DBNEWID: Release 10.2.0.4.0 - Production on Mon May 21 10:32:32 2012

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

Connected to database PROD9 (DBID=4167122059)

Connected to server version 10.2.0

Control Files in database:
    /u22/system/cntrl01.dbf
    /u52/idx/cntrl02.dbf
    /u21/undo/cntrl03.dbf

Change database ID and database name PROD9 to RAC? (Y/[N]) =>Y                   #要手动输入Y

Proceeding with operation
Changing database ID from 4167122059 to 2371814656
Changing database name from PROD9 to RAC
    Control File /u22/system/cntrl01.dbf - modified
    Control File /u52/idx/cntrl02.dbf - modified
    Control File /u21/undo/cntrl03.dbf - modified
    Datafile /u22/system/system01.dbf - dbid changed, wrote new name
    Datafile /u22/system/system02.dbf - dbid changed, wrote new name
    Datafile /u22/system/system03.dbf - dbid changed, wrote new name
    Datafile /u22/system/system04.dbf - dbid changed, wrote new name
    Datafile /u22/system/system05.dbf - dbid changed, wrote new name
    Datafile /u22/system/ctxd01.dbf - dbid changed, wrote new name
    Datafile /u22/system/owad01.dbf - dbid changed, wrote new name
    Datafile /u21/undo/rbs06.dbf - dbid changed, wrote new name
    Datafile /u21/undo/rbs07.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA26.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX25.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA27.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX26.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA28.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX27.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX28.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA29.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX29.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA30.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX30.dbf - dbid changed, wrote new name
    Datafile /u21/undo/rbs04.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA31.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA32.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX31.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA33.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX32.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA34.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA35.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX33.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SUMMARY06.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA36.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX34.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA37.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX35.dbf - dbid changed, wrote new name
    Datafile /u21/undo/rbs08.dbf - dbid changed, wrote new name
    Datafile /u21/undo/rbs09.dbf - dbid changed, wrote new name
    Datafile /u21/undo/rbs10.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA38.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX36.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX37.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX38.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SUMMARY07.dbf - dbid changed, wrote new name
    Datafile /u22/system/sysaux01.dbf - dbid changed, wrote new name
    Datafile /u22/system/igid01.dbf - dbid changed, wrote new name
    Datafile /u22/system/system06.dbf - dbid changed, wrote new name
    Datafile /u22/system/cfsd01.dbf - dbid changed, wrote new name
    Datafile /u22/system/cfsx01.dbf - dbid changed, wrote new name
    Datafile /u22/system/cuxd01.dbf - dbid changed, wrote new name
    Datafile /u22/system/cuxx01.dbf - dbid changed, wrote new name
    Datafile /u22/system/system07.dbf - dbid changed, wrote new name
    Datafile /u22/system/oem_repository.dbf - dbid changed, wrote new name
    Datafile /u22/system/oem_01.dbf - dbid changed, wrote new name
    Datafile /u22/system/interim.dbf - dbid changed, wrote new name
    Datafile /u21/undo/rbs05.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA01.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SEED01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_INTERFACE01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SUMMARY01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_NOLOGGING01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_ARCHIVE01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_QUEUES01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_MEDIA01.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_TOOLS01.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA02.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA03.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA04.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA05.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA06.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA07.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA08.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA09.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA10.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA11.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA12.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA13.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA14.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA15.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA16.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA17.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA18.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA19.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA20.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA21.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA22.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA23.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA24.dbf - dbid changed, wrote new name
    Datafile /u62/data/APPS_TS_TX_DATA25.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX02.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX03.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX04.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX05.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX06.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX07.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX08.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX09.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX10.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX11.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX12.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX13.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX14.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX15.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX16.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX17.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX18.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX19.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX20.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX21.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX22.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX23.dbf - dbid changed, wrote new name
    Datafile /u52/idx/APPS_TS_TX_IDX24.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SUMMARY02.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SUMMARY03.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SUMMARY04.dbf - dbid changed, wrote new name
    Datafile /u22/system/APPS_TS_SUMMARY05.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp09.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp08.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp07.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp06.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp05.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp04.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp03.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp02.dbf - dbid changed, wrote new name
    Datafile /u52/idx/temp01.dbf - dbid changed, wrote new name
    Control File /u22/system/cntrl01.dbf - dbid changed, wrote new name
    Control File /u52/idx/cntrl02.dbf - dbid changed, wrote new name
    Control File /u21/undo/cntrl03.dbf - dbid changed, wrote new name
    Instance shut down

Database name changed to RAC.
Modify parameter file and generate a new password file before restarting.
Database ID for database RAC changed to 2371814656.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

bash-3.2$
bash-3.2$
bash-3.2$sqlplus /nolog  

SQL*Plus: Release 10.2.0.4.0 - Production on Mon May 21 10:35:08 2012

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

SQL>conn / as sysdba
Connected to an idle instance.
SQL>create pfile from spfile;

File created.

修改pfile里的db_name:
[oracle@singledb dbs]$ cat initPROD9.ora
...
*.db_name='rac'              #只修改这一行即可
...

SQL>
SQL>startup mount pfile='/export/home/ora10/prod10db/10.2.0/dbs/initPROD9.ora';
ORACLE instance started.

Total System Global Area 5.3687E+10 bytes
Fixed Size                  2239008 bytes
Variable Size            1564005856 bytes
Database Buffers         5.2110E+10 bytes
Redo Buffers               10813440 bytes
Database mounted.
SQL>alter database open resetlogs;

Database altered.

SQL>create spfile from pfile;

File created.

SQL>select name,dbid,db_unique_name from v$database;

NAME                     DBID DB_UNIQUE_NAME
------------------ ---------- ------------------------------------------------------------
RAC                2371814656 RAC

SQL>select instance_name from v$instance;

INSTANCE_NAME
--------------------------------
PROD9

SQL>
SQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>startup

SQL>




更多参考:


the specified nodes are not clusterable

根据rowid删除表中重复的行

Agent process exited abnormally during initialization

一次字符乱码的解决过程

rman实验(一)

rman实验(二)

ORA-00600: internal error code, arguments: [keltnf

ORA-00600: ORA-12012 ORA-08102解决

linux下完全删除oracle

INFO: /usr/bin/ld: crt1.o: No such file: No such file or directory

centos4.8_64上安装oracle10201建库报ORA-12547

EM乱码解决

ORA-31613 Master process DM00 failed during startup

ORA-00600: internal error code, arguments: [4194], [29], [27], [], [], [], [], []

ORA-24324 ORA-01041 ORA-03113

centos5.3升级oracle

pdksh-5.2.14-36.el5.i386.rpm

使用rman进行数据库迁移

oracle10.2.0.1升级到10.2.0.4报错

Upgrade Oracle 10g from 10.2.0.1 to 10.2.0.4 (Single Instance)

改oracle的name和dbid

修改oracle实例名

Solaris8上迁移oracle8i---上

Solaris8上迁移oracle8i---下

未备份归档日志导致数据丢失的实验

使用NBU进行数据库迁移

catalog备份数据库

RMAN FORMAT字符串格式化

Error: can not register my instance state - -1

not all alterations performed

The ASM instance configured on the local node is a single-instance ASM

/u01/crs102/bin/crsctl.bin: error while loading shared libraries: libstdc++.so.5: cannot open shared

Initializing the Oracle ASMLib driver: [FAILED]

ORA-00245: control file backup operation failed

WARNING: failed to read mirror side 1 of virtual extent 229 logical extent

模拟恢复参数文件

Interface eth0 checked failed

import server uses ZHS16GBK character set (possible charset conversion)





原创粉丝点击