标签:pad spfile dbf 1.2 cte targe 条目 hive body
1、设置主库为归档模式
SQL> shutdown immediate SQL> startup mount SQL> alter database archivelog; SQL> archive log list; |
2、开启force logging
SQL> alter database force logging; Database altered. SQL> SQL> select name,database_role,log_mode,force_logging from v$database; NAME DATABASE_ROLE LOG_MODE FORCE_LOG ---------- ------------------------- --------------- --------- ORCL PRIMARY ARCHIVELOG YES |
3、配置监听文件,在auxiliary库上配置即可
(DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orcl) (ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = orcl) ) ) ADR_BASE_LISTENER = /u01/app/oracle |
4、配置tnsnames.ora文件
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.40)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) ) ORCLDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.41)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) ) |
5、cp target数据库的密码文件到auxiliary库
6、为auxiliary库创建必要的目录
7、为auxiliary准备一个参数文件,包含两个参数即可:
db_unique_name=orcl
8、启动auxiliary库到nomount状态
9、Rman连接target库和auxiliary库
[oracle@kaifai dbs]$ rman target sys/oracle@orcl auxiliary sys/oracle@orcldb Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jul 7 16:01:51 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1439188069) connected to auxiliary database: ORCL (not mounted) RMAN> |
10、rman下运行如下脚本
首先看一下target数据库的物理结构:
SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /data/oradata/orcl/orcl/system01.dbf /data/oradata/orcl/orcl/sysaux01.dbf /data/oradata/orcl/orcl/undotbs01.dbf /data/oradata/orcl/orcl/users01.dbf /u01/app/oracle/oradata/orcl/efmis01.dbf |
run{ duplicate target database to orcl from active database db_file_name_convert ‘/data/oradata/orcl/orcl‘,‘/data/oradata/orcl‘,‘/u01/app/oracle/oradata/orcl‘,‘/data/oradata/orcl‘ spfile set db_unique_name=‘orcl‘ set log_file_name_convert ‘/data/oradata/orcl/orcl‘,‘/data/oradata/orcl‘ set control_files=‘/data/oradata/orcl/control.ctl‘ ; } |
查看一下auxiliary库的物理结构:
SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /data/oradata/orcl/system01.dbf /data/oradata/orcl/sysaux01.dbf /data/oradata/orcl/undotbs01.dbf /data/oradata/orcl/users01.dbf /data/oradata/orcl/efmis01.dbf |
11、编辑/etc/oratab文件,添加如下条目:
orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y
注意:
db_file_name_convert 主数据库和备用数据库的数据文件转换目录对映(如果两数据库的目录结构不一样),如果有多个对映,逐一指明对映关系。
标签:pad spfile dbf 1.2 cte targe 条目 hive body
原文地址:http://www.cnblogs.com/wcwen1990/p/6661690.html