同机数据库克隆
第一步:
备份控制文件,数据库控制文件本分是一个二进制文件。将数据库备份为一个可读的文本文件,如下
根据
第二步:
根据alert_orcl.log文件的内容,查看最近备份的trc文件。复制log、dbf作为克隆数据库的资料。后创建control_file
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/oracle/oradata/orcl/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/oracle/oradata/orcl/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/oracle/oradata/orcl/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/oracle/oradata/orcl/system01.dbf',
'/u01/oracle/oradata/orcl/sysaux01.dbf',
'/u01/oracle/oradata/orcl/undotbs01.dbf',
'/u01/oracle/oradata/orcl/users01.dbf',
'/u01/oraclefile/recover/rman_tbsp.dbf'
CHARACTER SET AL32UTF8
把initorcl.ora文件修改成如下,注意删除control_file文件路径
注意:数据库克隆后的名字是test,所以环境变量需要换成test。启动到nomount状态
接下来创建control_file
CREATE CONTROLFILE REUSE SET DATABASE "TEST" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/oracle/oradata/test/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/oracle/oradata/test/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/oracle/oradata/test/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/oracle/oradata/test/system01.dbf',
'/u01/oracle/oradata/test/sysaux01.dbf',
'/u01/oracle/oradata/test/undotbs01.dbf',
'/u01/oracle/oradata/test/users01.dbf', s
'/u01/oracle/oradata/test/rman_tbsp.dbf'
CHARACTER SET AL32UTF8
查看control_file位置:show parameter control_file;
把control_file的位置复制到inittest.ora文件下
最后重新开启数据库检查是否克隆成功