跳至主要内容

Oracle学习笔记20080109

确定哪些是需要恢复
查看V$RECOVER_FILE视图确定哪些需要恢复
查看V$ARCHIVED_LOG数据库中归档redo log列表
查看V$RECOVERY_LOG在归档模式下需要回复的

User-Managed Recovery Procedures:
RECOVER Command恢复步骤
Recover a mounted database:
SQL> RECOVER DATABASE

Or
SQL> RECOVER DATAFILE'/ORADATA/u03/users01.dbf'Recover an open database:

SQL> RECOVER TABLESPACE users

Or
SQL> RECOVER DATAFILE '/ORADATA/u03/users01.dbf'


使用归档日志当在回复的时候
当改变本地归档模式用alter system archive log命令应有redo log
保证set autorecovery on命令当media回复输入auto,然后用recover automatic命令

Restoring Datafiles to a New Location with User-Managed Procedures
Use the ALTER DATABASE RENAME FILE command to record the change in the control file.

完整的recovery动作
关闭database恢复System datafiles,Undo segment datafiles,Whole database文件丢失类,打开数据库恢复当数据库刚开始打开硬件错误类,打开数据库恢复当数据库刚开始关闭数据文件恢复当没有数据文件备份

完整回复关闭的数据库
Shut down the instance-----Restore datafile 1(Log Sequence 144)----144Archived log file------Open the database

文件丢失类,打开数据库恢复当数据库刚开始打开都不影响system这个tablespace
Take datafile 2 offline-----Restore datafile 2---144 archived log file--Bring datafile 2 online

硬件错误类,打开数据库恢复当数据库刚开始关闭
Mount the database--Take datafile 2 offline--Open the database--Restore datafile 2--Archived log file--Bring datafile 2 online

数据文件恢复当没有数据文件备份重新建立丢失的数据文件除了备份Re-create the datafile:
SQL> ALTER DATABASE CREATE DATAFILE 'filename'

Re-create the datafile with a different filename:
SQL> ALTER DATABASE CREATE DATAFILE 'filename' AS 'new file name'


步骤Take the datafile or tablespace offline---Re-create the datafile--Archivedlog file--Bring the datafile or tablespace online

只读表空间回复重建控制文件,重命名datafile,用备份的control file 恢复control file和前面一样
RMAN Complete RecoveryRMAN完整恢复

Restore files from backup sets or image copies by using the RMAN RESTORE command
Recover files by using the RMAN RECOVER command
rman target /
RMAN> STARTUP MOUNT
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN;


Using RMAN to Restore Datafiles to a New Location
用SET NEWNAME 命令恢复到新地方
SET NEWNAME FOR DATAFILE 1 to '//system01.dbf'

用SWITCH命令记录换掉的control file
SWITCH DATAFILE ALL;

使用RMAN恢复表空间
run{sql "alter tablespace users offline immediate";
restore tablespace users;
recover tablespace users;
sql "alter tablespace users
online"}


Using RMAN to Relocate a Tablespace
Use the SET NEWNAME command to restore the files. Use the SWITCH command to record the new names in the control file.Use the RECOVER TABLESPACE command to recover the datafiles of the tablespace.

User-Managed Incomplete Recovery
非全备份出现的状况因为归档日志的丢失导致全备份失败所有未归档日志和数据文件丢失用户误操作原控制问就丢失备份文件必须要用到打开的数据库上。

不完全恢复的种类基于时间,基于推出卖家、、、、基于改变基础
Incomplete Recovery Guidelines Follow all steps carefully. Take whole database backups before and after recovery. Always verify that the recovery was successful. Back up and remove archived logs.Check the alert log before and after recoveryContains error information, hints, and SCNs
User-Managed Procedures for Incomplete Recovery
1. Shut down and back up the database.
2. Restore all datafiles. Do not restore the control file, redo logs, password file, or parameter file.
3. Mount the database.
4. Recover the datafiles to a point before the time of failure.
5. Open the database with RESETLOGS.6. Perform a closed database backup.

大概的recover命令
recover database until cancel;

Recover a database until time:
RECOVER DATABASE until time '200-03-04:14:22:03'

Recover using backup control file:

RECOVER DATABASE until time '200-03-04:14:22:03' using backup control
file




-----------------------
呵呵,今天发了一句话,然后就差不多吧

评论

此博客中的热门博文

4 steps to delete account in Gerrit DB

4 steps to delete account in DB. Delete from accounts where preferred_email=’’; delete from account_ssh_keys where account_id=''; delete from account_external_ids where external_id='gerrit:*’; delete from account_external_ids where external_id='username:*’; whatever it was in H2 database and postgres db . H2: ssh -p 24198 localhost gerrit gsql Postgres: psql

男人35岁前成功的12条黄金法则

第一章:一个目标 一艘没有航行目标的船,任何方向的风都是逆风 1、你为什么是穷人,第一点就是你没有立下成为富人的目标 2、你的人生核心目标是什么? 杰出人士与平庸之辈的根本差别并不是天赋、机遇,而在于有无目标。 3、起跑领先一步,人生领先一大步:成功从选定目标开始 4、贾金斯式的人永远不会成功 为什么大多数人没有成功?真正能完成自己计划的人只有5%,大多数人不是将自己的目标舍弃,就是沦为缺乏行动的空想 5、 如果你想在35岁以前成功,你一定在25至30岁之间确立好你的人生目标 6、 每日、每月、每年都要问自己:我是否达到了自己定下的目标 第二章:两个成功基点 站好位置,调正心态,努力冲刺,35岁以前成功 (一)人生定位 1、 人怕入错行:你的核心竞争力是什么? 2、 成功者找方法,失败者找借口 3、 从三百六十行中选择你的最爱 人人都可以创业,但却不是人人都能创业成功 4、 寻找自己的黄金宝地 (二)永恒的真理:心态决定命运,35岁以前的心态决定你一生的命运 1、 不满现状的人才能成为富翁 2、 敢于梦想,勇于梦想,这个世界永远属于追梦的人 3、 35岁以前不要怕,35岁以后不要悔 4、 出身贫民,并非一辈子是贫民,只要你永远保持那颗进取的心。中国成功人士大多来自小地方 5、 做一个积极的思维者 6、 不要败给悲观的自己 有的人比你富有一千倍,他们也会比你聪明一千倍么?不会,他们只是年轻时心气比你高一千倍。 人生的好多次失败,最后并不是败给别人,而是败给了悲观的自己。 7、 成功者不过是爬起来比倒下去多一次 8、 宁可去碰壁,也不要在家里面壁 克服你的失败、消极的心态 (1) 找个地方喝点酒 (2) 找个迪厅跳跳舞 (3) 找帮朋友侃侃山 (4) 积极行动起来 第三章:三大技巧 1、管理时间:你的时间在哪里,你的成就就在哪里。 把一小时看成60分钟的人,比看作一小时的人多60倍 2、你不理财,财不理你 3、自我管理,游刃有余 (1) 创业不怕本小,脑子一定要好 (2) 可以开家特色店 (3) 做别人不愿做的生意 第四章:四项安身立命的理念 35岁以前一定要形成个人风格 1、做人优于做事 做事失败可以重来,做人失败却不能重来 (1) 做人要讲义气 (2) 永不气馁 2、豁达的男人有财运,豁达的女人有帮夫运 35岁以前搞定婚姻生活 3、忠诚的原则: