[原创]ORACLE备份恢复_11g热备份_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2679 | 回复: 0   主题: [原创]ORACLE备份恢复_11g热备份        下一篇 
    本主题由 Administrator 于 2014-11-19 9:34:57 移动
tengfei.dong
注册用户
等级:中尉
经验:461
发帖:15
精华:0
注册:1970-1-1
状态:离线
发送短消息息给tengfei.dong 加好友    发送短消息息给tengfei.dong 发消息
发表于: IP:您无权察看 2014-11-17 17:49:45 | [全部帖] [楼主帖] 楼主

归档模式已经开启:

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oradata/arch
Oldest online log sequence 33
Next log sequence to archive 35
Current log sequence 35
SQL> select 'alter tablespace '||tablespace_name||' begin backup;' from dba_tablespaces where contents<>'TEMPORARY';
'ALTERTABLESPACE'||TABLESPACE_NAME||'BEGINBACKUP;'
-------------------------------------------------------------
alter tablespace SYSTEM begin backup;
alter tablespace SYSAUX begin backup;
alter tablespace UNDOTBS1 begin backup;
alter tablespace USERS begin backup;
SQL> alter tablespace SYSTEM begin backup;
alter tablespace SYSAUX begin backup;
alter tablespace UNDOTBS1 begin backup;
alter tablespace USERS begin backup;
Tablespace altered.
SQL>
Tablespace altered.
SQL>
Tablespace altered.
SQL>
Tablespace altered.
SQL> !
[oracle@localhost ~]$
[oracle@localhost ~]$ cd /oradata
[oracle@localhost oradata]$ ls
arch orcl
[oracle@localhost oradata]$ cd orcl
[oracle@localhost orcl]$ ls
control01.ctl control02.ctl redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
[oracle@localhost orcl]$ cp * /oracle/orabak0917/
[oracle@localhost orcl]$ cd /oracle/orabak0917/
[oracle@localhost orabak0917]$ ls
control01.ctl control02.ctl redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
[oracle@localhost orabak0917]$ exit
exit
SQL> select 'alter tablespace '||tablespace_name||' end backup;' from dba_tablespaces where contents<>'TEMPORARY';
'ALTERTABLESPACE'||TABLESPACE_NAME||'ENDBACKUP;'
-----------------------------------------------------------
alter tablespace SYSTEM end backup;
alter tablespace SYSAUX end backup;
alter tablespace UNDOTBS1 end backup;
alter tablespace USERS end backup;
SQL> alter tablespace SYSTEM end backup;
alter tablespace SYSAUX end backup;
alter tablespace UNDOTBS1 end backup;
alter tablespace USERS end backup;
Tablespace altered.
SQL>
Tablespace altered.
SQL>
Tablespace altered.
SQL>
Tablespace altered.
SQL>
--做一点数据更新,切换日志,手动归档
SQL> create table baktest (id number);
Table created.
SQL> alter system archive log current;
System altered.
SQL> alter system switch logfile;
System altered.
SQL>
SQL> !
[oracle@localhost ~]$ cd /oradata/orcl
[oracle@localhost orcl]$ ls
control01.ctl control02.ctl redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
[oracle@localhost orcl]$ rm control0*
[oracle@localhost orcl]$ exit
exit
SQL> insert into baktest (id) values (100);
1 row created.
SQL> commit;
Commit complete.
SQL> !
[oracle@localhost ~]$ cd /oradata/orcl
[oracle@localhost orcl]$ ls
redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
[oracle@localhost orcl]$ exit
exit
SQL> shutdown immediate
Database closed.
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oradata/orcl/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> !
[oracle@localhost ~]$ cd /oracle
[oracle@localhost oracle]$ ls
lost+found orabak0917 software
[oracle@localhost oracle]$ cd orabak0917
[oracle@localhost orabak0917]$ ls
control01.ctl control02.ctl redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
[oracle@localhost orabak0917]$ cp control01.ctl /oradata/orcl/
[oracle@localhost orabak0917]$ cp control02.ctl /oradata/orcl/
[oracle@localhost orabak0917]$ exit
exit
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2233000 bytes
Variable Size 520097112 bytes
Database Buffers 314572800 bytes
Redo Buffers 2379776 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/oradata/orcl/system01.dbf'
ORA-01207: file is more recent than control file - old control file
SQL>
SQL> select file#,CHECKPOINT_CHANGE#,LAST_CHANGE# from v$datafile;
FILE# CHECKPOINT_CHANGE# LAST_CHANGE#
---------- ------------------ ------------
1 536987
2 536993
3 536999
4 537005
SQL> select CHECKPOINT_CHANGE# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
539844
539844
539844
539844
SQL>
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 538754 generated at 09/17/2014 11:45:33 needed for thread 1
ORA-00289: suggestion : /oradata/arch/dbname_1_37_854903932.arc
ORA-00280: change 538754 for thread 1 is in sequence #37
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oradata/orcl/redo01.log
Log applied.
Media recovery complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
SQL> alter database open noresetlogs;
alter database open noresetlogs
*
ERROR at line 1:
ORA-01588: must use RESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL>
--恢复出来了


该贴由system转至本版2014-11-19 9:34:57



赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论