一、重建控制文件修改数据库名
步骤概述
目标:我们用原库LEO复制出新库LEO2
1.生成controlfile创建脚本并写入trace文件
SYS@LEO> alter database backup controlfile to trace;
2.执行查找trace文件语句,获取当前trace文件路径
SYS@LEO> select c.value || '/' || d.instance_name || '_ora_' || to_char(a.spid,'fm99999') || '.trc' from v$process a, v$session b, v$parameter c, v$instance d<wbr></wbr>where a.addr = b.paddr and b.audsid = userenv('sessionid') and c.name = 'user_dump_dest';
Trace文件路径
C.VALUE||'/'||D.INSTANCE_NAME||'_ORA_'||TO_CHAR(A.SPID,'FM99999')||'.TRC'
--------------------------------------------------------------------------------
/u01/app/oracle/admin/LEO/udump/LEO_ora_25621.trc
3.停掉数据库
SYS@LEO> shutdown immediate
Database closed.
Database dismounted.
ORACLE<wbr>instance shut down.</wbr>
4.只复制数据文件、redo日志(不需要复制控制文件哦!)
从原来的/u01/app/oracle/oradata/LEO/disk1复制到
/u01/app/oracle/oradata/LEO2/disk1
5.生成新的initLEO2.orac纯文本参数文件
export ORACLE_SID=LEO
sqlplus / as sysdba<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>进入原库执行命令
SYS@LEO> create pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initLEO2.ora' from spfile;
6.编辑新生成的initLEO2.ora纯文本参数文件
vim initLEO2.ora
需要修改的内容:
(1)路径
*.audit_file_dest='/u01/app/oracle/admin/LEO2/adump'
*.background_dump_dest='/u01/app/oracle/admin/LEO2/bdump'
*.control_files='/u01/app/oracle/oradata/LEO2/disk1/control01.ctl','/u01/app/oracle/oradata/LEO2/disk2/control02.ctl','/u01/app/oracle/oradata/LEO2/disk3/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/LEO2/cdump'
*.user_dump_dest='/u01/app/oracle/admin/LEO2/udump'
(2)数据库名
*.db_name='LEO2'
7.利用initLEO2.ora纯文本参数文件创建spfileLEO2.ora二进制参数文件
export ORACLE_SID=LEO2
sqlplus / as sysdba
SYS@LEO2> create spfile from pfile;<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>创建spfile
8.数据库启动到nomount状态,加载参数文件
SYS@LEO2> startup nomount
ORACLE instance started.
Total System Global Area<wbr></wbr>314572800 bytes
Fixed Size<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>1219184 bytes
Variable Size<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>96470416 bytes
Database Buffers<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>213909504 bytes
Redo Buffers<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>2973696 bytes
SYS@LEO2> show parameter name
NAME<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>TYPE<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string
db_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr>LEO2
db_unique_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr>LEO2
global_names<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>boolean<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr></wbr>FALSE
instance_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr><wbr></wbr>LEO2
lock_name_space<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string
log_file_name_convert<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string
service_names<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr><wbr><wbr></wbr></wbr>string<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr>LEO2
SYS@LEO2> select instance_name from v$instance;
INSTANCE_NAME
----------------
LEO2
9.删除原库控制文件(如果拷贝的时候包括了控制文件的话)
路径:
/u01/app/oracle/oradata/LEO2/disk1/control01.ctl,
/u01/app/oracle/oradata/LEO2/disk2/control02.ctl,
/u01/app/oracle/oradata/LEO2/disk3/control03.ctl
10.修改/u01/app/oracle/admin/LEO/udump/leo_ora_25621.trc文件的内容
vim<wbr></wbr>leo_ora_25621.trc
把内容拷贝到vim<wbr></wbr>test.sql临时文件中修改
定位--<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>Set #2. RESETLOGS case<wbr></wbr>位置
(1)把CREATE CONTROLFILE REUSE DATABASE "LEO" RESETLOGS<wbr></wbr>NOARCHIVELOG
修改成
CREATE CONTROLFILE SET DATABASE "LEO2" RESETLOGS<wbr></wbr>NOARCHIVELOG
(2)把在线日志文件和数据文件的路径中的“PROD”替换成“LEO2”,修改路径
例子:/u01/app/oracle/oradata/PROD/disk1/<wbr></wbr>替换
/u01/app/oracle/oradata/LEO2/disk1/
使用:%s#PROD#LEO2#方法替换所有“PROD”
最后的完成版并执行此脚本,就完成了控制文件的创建
CREATE CONTROLFILE SET DATABASE "LEO2" RESETLOGS<wbr></wbr>NOARCHIVELOG
<wbr><wbr><wbr></wbr></wbr></wbr>MAXLOGFILES 30
<wbr><wbr><wbr></wbr></wbr></wbr>MAXLOGMEMBERS 5
<wbr><wbr><wbr></wbr></wbr></wbr>MAXDATAFILES 100
<wbr><wbr><wbr></wbr></wbr></wbr>MAXINSTANCES 1
<wbr><wbr><wbr></wbr></wbr></wbr>MAXLOGHISTORY 292
LOGFILE
<wbr></wbr>GROUP 1 (
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/redo01.log',
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk2/redo01_2.log'
<wbr></wbr>) SIZE 100M,
<wbr></wbr>GROUP 2 (
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/redo02.log',
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk2/redo02_2.log'
<wbr></wbr>) SIZE 100M,
<wbr></wbr>GROUP 3 (
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/redo03.log',
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk2/redo03_2.log'
<wbr></wbr>) SIZE 100M,
<wbr></wbr>GROUP 4 (
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/redo04_1.log',
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk2/redo04_2.log'
<wbr></wbr>) SIZE 100M,
GROUP 5 (
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/redo05_1.log',
<wbr><wbr><wbr></wbr></wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk2/redo05_2.log'
) SIZE 100M
DATAFILE
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/system01.dbf',
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/undotbs01.dbf',
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/sysaux01.dbf',
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/example01.dbf',
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/indx01.dbf',
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/tools01.dbf',
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/user01.dbf',
<wbr></wbr>'/u01/app/oracle/oradata/LEO2/disk1/oltp01.dbf'
CHARACTER SET US7ASCII
;
11.把数据库启动到mount状态,在启动到open状态
注:必须添加resetlogs选项打开数据库,resetlogs所有以前的备份和归档日志均不可用
注:当我们执行完控制文件创建脚本后,数据库就已经是mount状态了。
SYS@LEO2> select open_mode,log_mode,name,dbid,db_unique_name from v$database;
<wbr></wbr>
OPEN_MODE<wbr></wbr>LOG_MODE<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>NAME<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>DBID<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>DB_UNIQUE_NAME
---------- ------------ --------- ---------- -----------------------------------------------------------------------
MOUNTED NOARCHIVELOG<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>LEO2<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>1558123773<wbr></wbr>LEO2
SYS@LEO2> alter database open resetlogs;<wbr><wbr></wbr></wbr>
SYS@LEO2> select file_name,file_id,tablespace_name,status from dba_data_files;
FILE_NAME<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr>FILE_ID TABLESPACE_NAME<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>STATUS
-------------------------------------------------- ---------- --------
/u01/app/oracle/oradata/LEO2/disk1/oltp01.dbf<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>8<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>OLTP<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>AVAILABLE
/u01/app/oracle/oradata/LEO2/disk1/user01.dbf<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>7<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>USERS<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>AVAILABLE
/u01/app/oracle/oradata/LEO2/disk1/tools01.dbf<wbr><wbr></wbr></wbr><wbr></wbr><wbr><wbr></wbr></wbr>6<wbr><span style="word-break: break-all; line-height: normal !important;"><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></span>TOOLS<span style="word-break: break-all; line-height: normal !important;"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span>AVAILABLE</wbr>
/u01/app/oracle/oradata/LEO2/disk1/indx01.dbf<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr><wbr></wbr></wbr>5<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>INDX<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>AVAILABLE
/u01/app/oracle/oradata/LEO2/disk1/example01.dbf<wbr></wbr>4<wbr></wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>EXAMPLE<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>AVAILABLE
/u01/app/oracle/oradata/LEO2/disk1/sysaux01.dbf<wbr><wbr></wbr></wbr><wbr></wbr><wbr></wbr>3<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr>SYSAUX<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>AVAILABLE
/u01/app/oracle/oradata/LEO2/disk1/undotbs01.dbf<wbr></wbr><wbr></wbr>2<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr>UNDOTBS<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>AVAILABLE
/u01/app/oracle/oradata/LEO2/disk1/system01.dbf<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>1<wbr></wbr>SYSTEM<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>AVAILABLE
11.新建LEO2密码文件
orapwd file=orapwLEO2 password=oracle entries=30
<wbr></wbr>
二、使用nid工具修改数据库名
Nid是oracle软件提供的一个小工具,可以修改数据库名称,位置:$ORACLE_HOME/bin/
优点:可以不用重建控制文件就修改数据库名
步骤概述
目标:我们用原库LEO2修改成新库LEO3,还用原来的控制文件、数据文件、在线日志
1.验证当前数据库名,实例名,服务名参数
SYS@LEO2> show parameter name
NAME<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>TYPE<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr></wbr></wbr>VALUE
------------------------------------ ----------- --------------------------------------------
db_file_name_convert<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string
db_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr></wbr></wbr></wbr><wbr></wbr><wbr><wbr></wbr></wbr>LEO2
db_unique_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr></wbr><wbr></wbr>LEO2
global_names<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>boolean<wbr><wbr><wbr></wbr></wbr></wbr><wbr></wbr>FALSE
instance_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr></wbr><wbr></wbr>LEO2
lock_name_space<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>string
log_file_name_convert<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string
service_names<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr></wbr><wbr></wbr>LEO2
SYS@LEO2> select open_mode,log_mode,name,dbid,db_unique_name from v$database;
OPEN_MODE<wbr></wbr>LOG_MODE<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>NAME<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>DBID<wbr></wbr>DB_UNIQUE_NAME
---------- ------------ --------- ---------- ----------------------------------------------------------------------
READ WRITE NOARCHIVELOG<wbr><wbr></wbr></wbr><wbr></wbr>LEO2<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>1558123773<wbr></wbr>LEO2
2.停掉数据库
SYS@LEO2> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
3.数据库启动到mount状态,nid工具在mount状态下才能用,直接修改控制文件内容
export ORACLE_SID=LEO2
sqlplus / as sysdba
SYS@LEO2> startup mount
ORACLE instance started.
Total System Global Area<wbr></wbr>314572800 bytes
Fixed Size<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>1219184 bytes
Variable Size<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>96470416 bytes
Database Buffers<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>213909504 bytes
Redo Buffers<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>2973696 bytes
Database mounted.
SYS@LEO2> exit
nid help=y
DBNEWID: Release 10.2.0.1.0 - Production on Mon May 21 16:57:06 2012
Copyright (c) 1982,<wbr><a href="http://space.itpub.net/?uid-26686207-action-viewspace-itemid-730563" target="_self"><u style="word-break: break-all; line-height: normal !important;"><strong style="word-break: break-all; line-height: normal !important;">2005</strong></u></a>, Oracle.<span style="word-break: break-all; line-height: normal !important;"><wbr></wbr></span>All rights reserved.</wbr>
Keyword<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>Description<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>(Default)
-----------------------------------------------------------------
TARGET<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr>Username/Password<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>(NONE)
DBNAME<wbr><wbr><wbr></wbr></wbr></wbr><wbr></wbr>New database name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>(NONE)
LOGFILE<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>Output Log<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>(NONE)
REVERT<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>Revert failed change<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr>NO
SETNAME<wbr><wbr><wbr></wbr></wbr></wbr>Set a new database name only<wbr></wbr>NO
APPEND<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>Append to output log<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>NO
HELP<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>Displays these messages<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr><wbr></wbr>NO
nid<wbr></wbr>target=sys/oracle dbname=LEO3
DBNEWID: Release 10.2.0.1.0 - Production on Mon May 21 16:59:10 2012
Copyright (c) 1982, 2005, Oracle.<wbr></wbr>All rights reserved.
Connected to database LEO2 (DBID=1558123773)<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr>--已连接当前数据库名
Connected to<wbr><a href="http://space.itpub.net/?uid-26686207-action-viewspace-itemid-730563" target="_self"><u style="word-break: break-all; line-height: normal !important;"><strong style="word-break: break-all; line-height: normal !important;">server</strong></u></a><wbr>version 10.2.0<span style="word-break: break-all; line-height: normal !important;"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="word-break: break-all; line-height: normal !important; color: rgb(0, 176, 240);">--</span></wbr></wbr>已连接服务器版本
Control Files in database:<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>--控制文件路径
<wbr><wbr><wbr></wbr></wbr></wbr>/u01/app/oracle/oradata/LEO2/disk1/control01.ctl
<wbr><wbr><wbr></wbr></wbr></wbr>/u01/app/oracle/oradata/LEO2/disk2/control02.ctl
<wbr><wbr><wbr></wbr></wbr></wbr>/u01/app/oracle/oradata/LEO2/disk3/control03.ctl
--是否同意修改数据库ID和数据库名
Change database ID and database name LEO2 to LEO3? (Y/[N]) =>y
Proceeding with operation
Changing database ID from 1558123773 to 1231291551<wbr></wbr>--修改数据库ID
Changing database name from LEO2 to LEO3<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>--修改数据库名
<wbr><wbr><wbr></wbr></wbr></wbr>Control File /u01/app/oracle/oradata/LEO2/disk1/control01.ctl – modified--控制文件已修改
<wbr><wbr><wbr></wbr></wbr></wbr>Control File /u01/app/oracle/oradata/LEO2/disk2/control02.ctl – modified
<wbr><wbr><wbr></wbr></wbr></wbr>Control File /u01/app/oracle/oradata/LEO2/disk3/control03.ctl – modified
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/system01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/undotbs01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/sysaux01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/example01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/indx01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/tools01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/user01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Datafile /u01/app/oracle/oradata/LEO2/disk1/oltp01.dbf - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Control File /u01/app/oracle/oradata/LEO2/disk1/control01.ctl - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Control File /u01/app/oracle/oradata/LEO2/disk2/control02.ctl - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Control File /u01/app/oracle/oradata/LEO2/disk3/control03.ctl - dbid changed, wrote new name
<wbr><wbr><wbr></wbr></wbr></wbr>Instance shut down<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>--当前数据库已经关闭
<wbr></wbr>
Database name changed to LEO3.<wbr></wbr>–数据库名已经修改完毕
Modify parameter file and generate a new password file before restarting.
--修改参数文件和在重启之前生成新的密码文件
Database ID for database LEO3 changed to 1231291551.
--数据库ID已经修改为:1231291551.
All previous backups and archived redo logs for this database are unusable.
--以前的备份和归档日志均不可用
Database has been shutdown, open database with RESETLOGS option.
--数据库已关闭,必须使用RESETLOGS选项打开数据库
Succesfully changed database name and ID.
--已成功修改数据库名和数据库ID
DBNEWID - Completed succesfully.
-- DBNEWID成功完成
4.生成新的initLEO3.orac纯文本参数文件并修改数据库名和路径
SYS@LEO2> create pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initLEO3.ora' from spfile;
vim<wbr></wbr>initLEO3.ora
(1)路径
*.audit_file_dest='/u01/app/oracle/admin/LEO3/adump'
*.background_dump_dest='/u01/app/oracle/admin/LEO3/bdump'
*.control_files='/u01/app/oracle/oradata/LEO3/disk1/control01.ctl','/u01/app/oracle/oradata/LEO2/disk2/control02.ctl','/u01/app/oracle/oradata/LEO3/disk3/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/LEO3/cdump'
*.user_dump_dest='/u01/app/oracle/admin/LEO3/udump'
(2)数据库名
*.db_name='LEO3'
5.利用initLEO3.ora纯文本参数文件创建spfileLEO3.ora二进制参数文件
SYS@LEO2> create spfile='/u01/app/oracle/product/10.2.0/db_1/dbs/spfileLEO3.ora' from pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initLEO3.ora';
6.创建转储目录
mkdir -p $ORACLE_BASE/admin/LEO3/adump
mkdir -p $ORACLE_BASE/admin/LEO3/bdump
mkdir -p $ORACLE_BASE/admin/LEO3/cdump
mkdir -p $ORACLE_BASE/admin/LEO3/udump
7.直接启动数据库到open状态
注:必须添加resetlogs选项打开数据库,resetlogs所有以前的备份和归档日志均不可用
export ORACLE_SID=LEO3
sqlplus / as sysdba
SYS@LEO3> startup
ORACLE instance started.
Total System Global Area<wbr></wbr>314572800 bytes
Fixed Size<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>1219184 bytes
Variable Size<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>96470416 bytes
Database Buffers<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>213909504 bytes
Redo Buffers<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>2973696 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
必须使用RESETLOGS和NORESETLOGS选项打开数据库
SYS@LEO3> alter database open resetlogs;
8.检查当前数据库名,实例名,服务名参数
SYS@LEO3> show parameter name
NAME<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>TYPE<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>VALUE
------------------------------------ ----------- ----------------------------------------------------
db_file_name_convert<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr><wbr></wbr>string
db_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr><wbr></wbr></wbr><wbr></wbr>LEO3
db_unique_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr><wbr></wbr></wbr><wbr></wbr>LEO3
global_names<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>boolean<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr></wbr>FALSE
instance_name<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr><wbr></wbr>LEO3
lock_name_space<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string
log_file_name_convert<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>string
service_names<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>string<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr><wbr></wbr>LEO3
SYS@LEO3> select open_mode,log_mode,name,dbid,db_unique_name from v$database;
<wbr></wbr>
OPEN_MODE<wbr></wbr>LOG_MODE<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>NAME<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>DBID DB_UNIQUE_NAME
---------- ------------ --------- ---------- ------------------------------
READ WRITE NOARCHIVELOG<wbr><wbr></wbr></wbr><wbr></wbr>LEO3<wbr><wbr><wbr></wbr></wbr></wbr><wbr><wbr><wbr></wbr></wbr></wbr><wbr><wbr></wbr></wbr>1231291551<wbr></wbr><wbr></wbr>LEO3
SYS@LEO3> select instance_name,status from v$instance;
INSTANCE_NAME<wbr><wbr><wbr></wbr></wbr></wbr>STATUS
---------------- ------------ ------------
LEO3<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr></wbr>OPEN
9.新建LEO3密码文件
orapwd file=orapwLEO3 password=oracle entries=30
10.修改listener.ora和tnsnames.ora文件内容
cd<wbr></wbr>/u01/app/oracle/product/10.2.0/db_1/network/admin
修改vim listener.ora
LISTENER=
<wbr></wbr>(DESCRIPTION=
<wbr><wbr><wbr></wbr></wbr></wbr>(ADDRESS_LIST=
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521))
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
<wbr></wbr>
SID_LIST_LISTENER=
<wbr></wbr>(SID_LIST=
<wbr><wbr><wbr></wbr></wbr></wbr>(SID_DESC=
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(GLOBAL_DBNAME=LEO3)
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(SID_NAME=LEO3))
<wbr><wbr><wbr></wbr></wbr></wbr>(SID_DESC=
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(SID_NAME=pl***tproc)
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>(PROGRAM=extproc)))
修改vim tnsnames.ora
LEO3=
<wbr></wbr>(description =
<wbr><wbr><wbr></wbr></wbr></wbr>(address=(protocol=tcp)(host=192.168.1.10)(port=1521))
<wbr><wbr><wbr></wbr></wbr></wbr>(connect_data=
<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>(server = dedicated)
<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>(service_name = LEO3)
<wbr></wbr>)
<wbr></wbr>)
重启监听
lsnrctl reload listener
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 21-MAY-2012 17:34:29
Copyright (c) 1991, 2005, Oracle.<wbr></wbr>All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
The command completed successfully
测试监听
sqlplus system/oracle@LEO3
SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 21 17:35:25 2012
Copyright (c) 1982, 2005, Oracle.<wbr></wbr>All rights reserved.
Connected to:
Oracle Database<wbr><a href="http://space.itpub.net/?uid-26686207-action-viewspace-itemid-730563" target="_self"><u style="word-break: break-all; line-height: normal !important;"><strong style="word-break: break-all; line-height: normal !important;">10g</strong></u></a><wbr>Enterprise Edition Release 10.2.0.1.0 - Production</wbr></wbr>
With the Partitioning, OLAP and<wbr><a href="http://space.itpub.net/?uid-26686207-action-viewspace-itemid-730563" target="_self"><u style="word-break: break-all; line-height: normal !important;"><strong style="word-break: break-all; line-height: normal !important;">Data</strong></u></a><wbr>Mining options</wbr></wbr>
SYSTEM@LEO3>
<wbr></wbr>
小结:到此所有的数据库名、实例名、服务名已经都被修改过来了,有了这2种方法我们可以快速的建立起带数据的新数据库。支持我们的研发和测试
注意:参数文件修改
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>控制文件修改
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>密码文件修改
<wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr>监听文件修改
<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><wbr></wbr>数据文件和日志文件根据需要进行创建