设为首页 加入收藏

TOP

oracle使用备份的控制文件恢复,并且之后新建了表空间的恢复(一)
2015-11-21 01:48:24 来源: 作者: 【 】 浏览:2
Tags:oracle 使用 备份 控制 文件 恢复 并且 之后 新建 空间

1.备份的控制文件之后创建表空间,控制文件全部丢失,使用备份控制文件如何恢复

步骤如下:
1.备份数据库

rman target / catalog RC_ADMIN/RC_ADMIN@prod3


backup database plus archivelog delete all input;

?

2.创建表空间
SYS@PROD2>create tablespace indx
2 datafile '/u01/app/oracle/oradata/PROD2/indx01.dbf'
3 size 10m;
3.创建表,指定表空间为indx
SYS@PROD2>create table test tablespace indx as select * from scott.emp;

Table created.


SYS@PROD2>select * from test;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10

14 rows selected.

SYS@PROD2>alter system switch logfile;

System altered.

--删除部分记录用于测试
SYS@PROD2>delete test where deptno=30;

6 rows deleted.

SYS@PROD2>commit;

Commit complete.

SYS@PROD2>select * from test;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10

8 rows selected.


4.删除全部的控制文件
oracle@node102.cuug.com:/u01/app/oracle/oradata/PROD2> rm -rf control*

alert 日志里面报找不到控制文件
Tue May 12 02:15:47 2015
Errors in file /u01/app/oracle/diag/rdbms/prod2/PROD2/trace/PROD2_m000_4995.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/PROD2/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory

5.关闭数据库启动到nomount
SYS@PROD2>shutdown abort;
ORACLE instance shut down.
SYS@PROD2>startup nomount;
ORACLE instance started.

Total System Global Area 630501376 bytes
Fixed Size 2215984 bytes
Variable Size 255856592 bytes
Database Buffers 364904448 bytes
Redo Buffers 7524352 bytes

6.登录rman 恢复之前备份的控制文件
oracle@node102.cuug.com:/u01/app/oracle/oradata/PROD2> rman target / catalog RC_ADMIN/RC_ADMIN@prod3

Recovery Manager: Release 11.2.0.1.0 - Production on Tue May 12 02:19:25 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: PROD2 (not mounted)
connected to recovery catalog database

RMAN> restore controlfile;

Starting restore at 12-MAY-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=180 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=11 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: reading from backup piece /home/oracle/rman_bk/control/c-1529226433-20150512-02
channel ORA_DISK_1: piece handle=/home/oracle/rman_bk/control/c-1529

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Oracle将一列分成多列 下一篇oracle12c安装,连接,使用等

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: