Source database Duplicate database
SYSTEM: windows server 2008 R2 SYSTEM: windows server 2008 R2
IP ADDRESS:192.168.2.188 IP ADDRESS:192.168.2.199
HOST NAME:beijing HOST NAME:suzhou
ORACLE SID: orcl ORACLE SID: orcl
TNSNAMES:bj TNSNAMES:sz
1.源数据库和目标数据库检测
set oracle_sid=orcl
col name heading '实例名' for a10
col version heading '数据库版本' for a15
col platform_name heading '操作系统平台' for a30
col endian_format heading '字节顺序' for a15
SELECT d.NAME, i.VERSION, d.PLATFORM_NAME, ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d, V$INSTANCE i
WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME
and d.DB_UNIQUE_NAME = i.INSTANCE_NAME;
2.源数据库新建测试表空间和用户
create tablespace ocp
datafile 'F:\app\Administrator\oradata\orcl\ocp01.dbf'
size 100m
autoextend on next 10m maxsize unlimited
extent management local autoallocate
segment space management auto;
create user test identified by password
default tablespace ocp
temporary tablespace temp;
grant dba to test;
conn test/password@orcl
create table t1
(
sid int not null primary key,
sname varchar2(10)
);
insert into t1 values(101,'wind');
insert into t1 values(102,'snow');
insert into t1 values(103,'apple');
commit;
select table_name from dba_tables where tablespace_name='OCP';
connect / as sysdba
create directory dump as 'f:\dump'; --必须创建此目录 f:\dump
drop directory dump;--删除
exit;
5.使用rman备份源数据库
rman>
run {
configure retention policy to recovery window of 14 days;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to 'F:\backup\bak_%F';
allocate channel c1 device type disk format 'F:\backup\bak_%u';
allocate channel c2 device type disk format 'F:\backup\bak_%u';
backup database skip inaccessible
plus archivelog filesperset 20
delete all input;
release channel c1;
release channel c2;
}
allocate channel for maintenance device type disk;
crosscheck backupset;
delete noprompt obsolete;