恢复编录-前奏曲

RMAN> delete noprompt backup;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=120 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=159 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=121 devtype=DISK

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
107     107     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5jpu6p0k_1_1
108     108     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5kpu6p0l_1_1
109     109     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5ipu6p0k_1_1
110     110     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5lpu6p3j_1_1
111     111     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5mpu6p3m_1_1
112     112     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5npu6p3n_1_1
113     113     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5opu6pk1_1_1
114     114     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5ppu6pn0_1_1
115     115     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5qpu6pr2_1_1
116     116     1   1   AVAILABLE   DISK        /u01/oracle/11G/dbs/5rpu6prg_1_1
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5jpu6p0k_1_1 recid=107 stamp=870540309
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5kpu6p0l_1_1 recid=108 stamp=870540311
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5ipu6p0k_1_1 recid=109 stamp=870540308
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5lpu6p3j_1_1 recid=110 stamp=870540405
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5mpu6p3m_1_1 recid=111 stamp=870540406
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5npu6p3n_1_1 recid=112 stamp=870540408
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5opu6pk1_1_1 recid=113 stamp=870540930
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5ppu6pn0_1_1 recid=114 stamp=870541024
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5qpu6pr2_1_1 recid=115 stamp=870541155
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/5rpu6prg_1_1 recid=116 stamp=870541169
Deleted 10 objects


RMAN> list copy;


List of Control File Copies
Key     S Completion Time Ckp SCN    Ckp Time        Name
------- - --------------- ---------- --------------- ----
6       A 01-FEB-15       1736656    01-FEB-15       /u01/oracle/11G/dbs/cf_D-DB01_id-1467107934_5tpu6q5e
5       A 01-FEB-15       1736447    01-FEB-15       /u01/oracle/11G/dbs/cf_D-DB01_id-1467107934_5spu6pru

List of Archived Log Copies
Key     Thrd Seq     S Low Time  Name
------- ---- ------- - --------- ----
95      1    90      A 01-FEB-15 /u01/oracle/11G/dbs/arch1_90_835839902.dbf
96      1    91      A 01-FEB-15 /u01/oracle/11G/dbs/arch1_91_835839902.dbf
97      1    92      A 02-FEB-15 /u01/oracle/11G/dbs/arch1_92_835839902.dbf

RMAN> delete copy;

released channel: ORA_DISK_1
released channel: ORA_DISK_2
released channel: ORA_DISK_3
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=120 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=159 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=121 devtype=DISK

List of Control File Copies
Key     S Completion Time Ckp SCN    Ckp Time        Name
------- - --------------- ---------- --------------- ----
6       A 01-FEB-15       1736656    01-FEB-15       /u01/oracle/11G/dbs/cf_D-DB01_id-1467107934_5tpu6q5e
5       A 01-FEB-15       1736447    01-FEB-15       /u01/oracle/11G/dbs/cf_D-DB01_id-1467107934_5spu6pru

List of Archived Log Copies
Key     Thrd Seq     S Low Time  Name
------- ---- ------- - --------- ----
95      1    90      A 01-FEB-15 /u01/oracle/11G/dbs/arch1_90_835839902.dbf
96      1    91      A 01-FEB-15 /u01/oracle/11G/dbs/arch1_91_835839902.dbf
97      1    92      A 02-FEB-15 /u01/oracle/11G/dbs/arch1_92_835839902.dbf

Do you really want to delete the above objects (enter YES or NO)? yes
deleted control file copy
control file copy filename=/u01/oracle/11G/dbs/cf_D-DB01_id-1467107934_5tpu6q5e recid=6 stamp=870541486
deleted control file copy
control file copy filename=/u01/oracle/11G/dbs/cf_D-DB01_id-1467107934_5spu6pru recid=5 stamp=870541183
deleted archive log
archive log filename=/u01/oracle/11G/dbs/arch1_90_835839902.dbf recid=95 stamp=870541153
deleted archive log
archive log filename=/u01/oracle/11G/dbs/arch1_91_835839902.dbf recid=96 stamp=870566554
deleted archive log
archive log filename=/u01/oracle/11G/dbs/arch1_92_835839902.dbf recid=97 stamp=870739562
Deleted 5 objects


RMAN> list copy;

specification does not match any archive log in the recovery catalog

RMAN> 


Connecting to 192.168.55.55:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Thu Feb  5 22:01:09 2015 from 192.168.55.100
[oracle@MasterHadoop50 ~]$  sqlplus "/as sysdba";

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 5 22:05:20 2015

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> select name from datafiles;
select name from datafiles
                 *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select name from dba_datafiles;
select name from dba_datafiles
                 *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select name from dba_datafile;
select name from dba_datafile
                 *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select name from v$datafiles;
select name from v$datafiles
                 *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/db01/system01.dbf
/u01/oracle/oradata/db01/undotbs01.dbf
/u01/oracle/oradata/db01/sysaux01.dbf
/u01/oracle/oradata/db01/users01.dbf
/tmp/test_block_size.dbf
/u01/oracle/oradata/db01/ts_test_me/frankts01.dbf
/u01/oracle/oradata/db01/ts_test_me/demots01.dbf
/u01/oracle/oradata/db01/ts_test_me/undots01.dbf
/u01/oracle/oradata/db01/ts_test_me/frankts2.dbf
/u01/oracle/oradata/db01/ts_test_me/bigts01.dbf
/u01/oracle/oradata/db01/ts_test_me/dtfilets01.dbf

NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/db01/ts_test_me/dtfilets2.dbf
/tmp/local.dbf

13 rows selected.

SQL> select host_name from v$instance;

HOST_NAME
----------------------------------------------------------------
MasterHadoop50

SQL> select utl_inaddr.get_host_address('MasterHadoop50') from dual;

UTL_INADDR.GET_HOST_ADDRESS('MASTERHADOOP50')
--------------------------------------------------------------------------------
192.168.55.55

SQL> create tablespace rc_data datafile '/u01/oracle/oradata/db01/ts_test_rman/rc_data01.dbf' size 20m autoextend on next 4m;
create tablespace rc_data datafile '/u01/oracle/oradata/db01/ts_test_rman/rc_data01.dbf' size 20m autoextend on next 4m
*
ERROR at line 1:
ORA-01119: error in creating database file
'/u01/oracle/oradata/db01/ts_test_rman/rc_data01.dbf'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory


SQL> host mkdir /u01/oracle/oradata/db01/ts_test_rman


SQL> create tablespace rc_data datafile '/u01/oracle/oradata/db01/ts_test_rman/rc_data01.dbf' size 20m autoextend on next 4m;


Tablespace created.--创建表空间成功证明的确是要创建的数据文件目录不存在。


SQL> create user account rcowner identified by rcowner temporary tablespace temp default tablespace rc_data quato unlimited on rc_data;
create user account rcowner identified by rcowner temporary tablespace temp default tablespace rc_data quato unlimited on rc_data
                    *
ERROR at line 1:
ORA-00922: missing or invalid option

SQL> create user rcowner identified by rcowner temporary tablespace temp default tablespace rc_data quato unlimited on rc_data;
create user rcowner identified by rcowner temporary tablespace temp default tablespace rc_data quato unlimited on rc_data
                                                                                               *
ERROR at line 1:
ORA-00922: missing or invalid option

SQL> select name from tablespace;
select name from tablespace
                 *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select name from tablespaces;
select name from tablespaces
                 *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select name from dba_tablespaces;
select name from dba_tablespaces
       *
ERROR at line 1:
ORA-00904: "NAME": invalid identifier

SQL> select tablespacename from dba_tablespaces;
select tablespacename from dba_tablespaces
       *
ERROR at line 1:
ORA-00904: "TABLESPACENAME": invalid identifier

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
TEMP
USERS
TS_16K
FRANKS
DEMOTS
TEMPTS
TEMPTS02
UNDOTS

TABLESPACE_NAME
------------------------------
TEMPTS_TEMPFILE
BIGTS
DTFILETS
LOCAL
RC_DATA

16 rows selected.

SQL> create user rcowner identified by rcowner temporary tablespace temp default tablespace rc_data quato unlimited on rc_data;
create user rcowner identified by rcowner temporary tablespace temp default tablespace rc_data quato unlimited on rc_data
                                                                                               *
ERROR at line 1:
ORA-00922: missing or invalid option

SQL> create user rcowner identified by rcowner temporary tablespace temp default tablespace rc_data quota unlimited on rc_data;

User created.

SQL> show user
USER is "SYS"
SQL> grant recovery_catalog_owner to rcowner;

Grant succeeded.--角色授予

SQL> conn rcowner/rcowner;
Connected.
SQL> select object_type,count(*) from user_objects group by object_type;

no rows selected

SQL>

---下面通过rman连接至编录数据库,在目标数据库登录编录数据库。

[oracle@Slave1Hadoop51 ~]$ rman catalog rcowner/rcowner@db02;

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 3 09:46:04 2015

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to recovery catalog database

RMAN> create catalog;

recovery catalog created

RMAN> 

--编录数据库主机。

SQL> show user
USER is "RCOWNER"
SQL> select object_type,count(*) from user_objects group by object_type;

OBJECT_TYPE      COUNT(*)
------------------- ----------
SEQUENCE     1
PACKAGE     2
PACKAGE BODY      2
TYPE BODY     1
FUNCTION     1
VIEW    53
INDEX    95
TABLE    37
TYPE     3

9 rows selected.

有了记录, create catalog命令起了作用,不过没有触发器可能与数据库版本有关系,分组每组的总数也与其他数据库不同,可能与数据库版本有关系

在编录数据库还没有注册目标数据库之前,db表无记录。

SQL> select * from db; 

no rows selected

如下,同时连接目标数据库与编录数据库。

RMAN> exit

Recovery Manager complete.
[oracle@Slave1Hadoop51 ~]$ rman target / catalog rcowner/rcowner@db02;

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 3 09:57:31 2015

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: DB01 (DBID=1467107934)
connected to recovery catalog database

RMAN> register database;--将目标数据库信息注册入恢复编录数据库。

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete.--完全同步

RMAN>

在编录数据库再次查询,有记录了1467107934正是目标数据库的ID.

SQL> select * from db; 

    DB_KEY DB_ID HIGH_CONF_RECID LAST_KCCDIVTS HIGH_IC_RECID CURR_DBINC_KEY
---------- ---------- --------------- ------------- ------------- --------------
1            1467107934 857057135 2       2

SQL> 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

5icode.top

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值