SQL> set sqlp "SQL_131> ";
SQL_131> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
--实验开始
/*
之前手工备份控制文件
[oracle@m131 GDBNAME]$ cp control/control01.ctl control_bak/control01.ctl
*/
SQL_131> startup;
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 272632220 bytes
Database Buffers 138412032 bytes
Redo Buffers 6103040 bytes
Database mounted.
Database opened.
SQL_131> create tablespace test logging datafile '/u01/GDBNAME/oradata/test01.dbf' size 10M;
Tablespace created.
--SQL_131> create user test identifeid by test default tablespace test;
SQL_131> alter user test default tablespace test; --之前建过该用户
User altered.
SQL_131> conn test/test;
Connected.
SQL_131> create table test001(f001 varchar2(10), f002 varchar2(10));
Table created.
SQL_131> insert into test001 select 1,1 from dual;
1 row created.
SQL_131> commit;
Commit complete.
SQL_131> conn /as sysdba
Connected.
SQL_131> shutdown immedaite;
SP2-0717: illegal SHUTDOWN option
SQL_131> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
/*
手工copy之前备份的控制文件覆盖当前控制文件
[oracle@m131 GDBNAME]$ cp control_bak/control01.ctl control/control01.ctl
[oracle@m131 GDBNAME]$ cp control_bak/control01.ctl /u02/GDBNAME/control/control02.ctl
*/
SQL_131> startup
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 272632220 bytes
Database Buffers 138412032 bytes
Redo Buffers 6103040 bytes
Database mounted.
ORA-01190: control file or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: '/u01/GDBNAME/oradata/system01.dbf'
SQL_131> alter database backup controlfile to trace;
Database altered.
/*
备份到trace文件prim_un_name_ora_5290.trc中
*/
SQL_131> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL_131> startup nomount;
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 272632220 bytes
Database Buffers 138412032 bytes
Redo Buffers 6103040 bytes
SQL_131> CREATE CONTROLFILE REUSE DATABASE "GDBNAME" RESETLOGS FORCE LOGGING ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 (
9 '/u01/GDBNAME/redo/redo0101.log',
10 '/u02/GDBNAME/redo/redo0102.log'
11 ) SIZE 10M BLOCKSIZE 512,
12 GROUP 2 (
13 '/u01/GDBNAME/redo/redo0201.log',
14 '/u02/GDBNAME/redo/redo0202.log'
15 ) SIZE 10M BLOCKSIZE 512,
16 GROUP 3 (
17 '/u01/GDBNAME/redo/redo0301.log',
18 '/u02/GDBNAME/redo/redo0302.log'
19 ) SIZE 10M BLOCKSIZE 512
20 -- STANDBY LOGFILE
21 DATAFILE
22 '/u01/GDBNAME/oradata/system01.dbf',
23 '/u01/GDBNAME/oradata/sysaux01.dbf',
24 '/u01/GDBNAME/oradata/undotbs01.dbf',
25 '/u01/GDBNAME/oradata/users01.dbf',
26 '/u01/GDBNAME/oradata/dy01.dbf',
27 '/u01/GDBNAME/oradata/test01.dbf' --之前的控制文件中没有的文件,需要手工加入
28 CHARACTER SET ZHS16GBK
29 ;
Control file created.
SQL_131> recover database using backup controlfile until cancel;
ORA-00279: change 1854802 generated at 02/15/2015 02:49:48 needed for thread 1
ORA-00289: suggestion : /u02/GDBNAME/arc/1_1_871698573.dbf
ORA-00280: change 1854802 for thread 1 is in sequence #1
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log '/u02/GDBNAME/arc/1_1_871698573.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log '/u02/GDBNAME/arc/1_1_871698573.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL_131> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------ ------------ ------------
1 1 0 10485760 512 2 YES UNUSED 0 0
3 1 0 10485760 512 2 YES CURRENT 0 0
2 1 0 10485760 512 2 YES UNUSED 0 0
SQL_131> recover database using backup controlfile until cancel;
ORA-00279: change 1854802 generated at 02/15/2015 02:49:48 needed for thread 1
ORA-00289: suggestion : /u02/GDBNAME/arc/1_1_871698573.dbf
ORA-00280: change 1854802 for thread 1 is in sequence #1
Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/GDBNAME/redo/redo0101.log
Log applied.
Media recovery complete.
SQL_131> alter database open resetlogs;
Database altered.
SQL_131> conn test/test;
Connected.
SQL_131> select * from test001;
F001 F002
---------- ----------
1 1
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24805255/viewspace-723358/
,如需转载,请注明出处,否则将追究法律责任。