ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN duplicate迁移数据库

RMAN duplicate迁移数据库

原创 Linux操作系统 作者:hjianping 时间:2011-04-24 14:12:20 0 删除 编辑

1、在辅助机上安装Oracle(不安装实例),并配置监听(参考双实例监听设置)

listener.ora 文件
=========================================
    (SID_DESC =
        (GLOBAL_DBNAME = ora10)
        (ORACLE_HOME = /u01/oracle)  
        (SID_NAME = ora10)
     )
    
    (SID_DESC =
        (GLOBAL_DBNAME = test)
        (ORACLE_HOME = /u01/oracle)  
        (SID_NAME = test)
     )
=========================================

tnsnames.ora 文件
=======================================================================
ora10 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ora10)
    )
  )

test =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.130)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test)
    )
  )
=======================================================================


2、创建辅助实例的密码文件(cd /u01/oracle/dbs)
orapwd file=/u01/oracle/dbs/orapwtest password=Aa111111 entries=3 --(entries=3指特权用户数)

(windows下)使用oradim创建新的instance (windows)
oradim -new -sid test
set oracle_sid=test
sqlplus / as sysdba


3、创建相关目录
mkdir -p /u01/admin/test/adump
mkdir -p /u01/admin/test/bdump
mkdir -p /u01/admin/test/cdump
mkdir -p /u01/admin/test/dpdump
mkdir -p /u01/admin/test/pfile
mkdir -p /u01/admin/test/udump
mkdir -p /u01/flash_recovery_area
mkdir -p /u01/oradata/test


4、创建并修改参数文件

在原数据库上创建pfile
create pfile='/u01/admin/test/pfile/init.ora' from spfile;

复制pfile到辅助数据库
scp /u01/admin/test/pfile/init.ora 192.168.1.130:/u01/admin/test/pfile/inittest.ora'

修改复制数据库的pfile,并添加如下内容
========================================================================
*.db_file_name_convert=('/u01/oradata/ora10','/u01/oradata/test')
*.log_file_name_convert=('/u01/oradata/ora10','/u01/oradata/test')
========================================================================

在辅助数据库上创建spfile
create spfile from pfile='/u01/admin/test/pfile/inittest.ora';


5、使用rman备份原数据库(原数据库必须为归档模式),并复制备份集到辅助数据库对应的目录。
alter database archivelog;
archive log list;


6、启动辅助实例
startup force nomount;


7、使用rman复制数据库
rman target sys/Aa111111@ora10 auxiliary sys/Aa111111@test

RMAN> run {
2> allocate auxiliary channel d1 type disk;
3> set until scn 579379;
4> duplicate target database to "test";
5> release channel d1;
6> }


8、检查复制库的状态
sqlplus sys/Aa111111@test as sysdba
select instance_name,status from v$instance;
alter database open resetlogs;


9、修改参数文件(删除*.db_file_name_convert,*.log_file_name_convert)
create pfile from spfile;
shutdown immediate;
create spfile from pfile;
startup;


10、创建临时表空间
alter tablespace temp add tempfile '/u01/oradata/test/temp01.dbf' size 100M;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17012874/viewspace-693296/,如需转载,请注明出处,否则将追究法律责任。

上一篇: RMAN Complete
请登录后发表评论 登录
全部评论

注册时间:2011-04-24

  • 博文量
    80
  • 访问量
    72830