跳至主要内容

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




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

评论

此博客中的热门博文

Python学习笔记20100117

映射list   Dictionary 是用{}. list 是一那个[]. turple是用() 当你定义过dictionary后,你可以使用d.keys(), d.values(),d.items()将定义后的时候分别显示出来 当然可以将list里的值加减乘除,也可以如一般的定义直接重新复制这个list. 链接与分割字符串的 li=";", join(li) 则显示的就是 分隔符为;的数 如果使用li=li.split(";")则将刚刚;的分隔符删除,而split里也可定义域,如li.split(";",1)   自省 <---这是啥 之前在使用的时候发觉有些书本上的模块不能调用,很多是py脚本定义过的函数。 下载该脚本s,然后上传至指定位置。 >>>import sys >>>sys.path >>>sys.path.append("绝对位置")然后就能调用这些脚本和参数了。 删除 >>>sys.path.pop() 定义一个参数是 def info(test, test1=10.test2=12): info是函数名,test是必备参数,因为没有定义值,test1和test2是可选参数,定义了初始值   以上是外部函数的调用,下面转到内部函数 内部函数有type,str,dir及其他   ---type 返回任意字符的类型,模块也可以。types模块 >>> type(1) <type 'int'> >>> li=[] >>> type(li) <type 'list'> >>> import odbchelper >>> type(odbchelper) <type 'module'> >>> type(sys) <type 'module'> >>> import types ...

Oracle学习笔记20080118

做个rman的backup脚本,发觉对shell研究不是很深,纯建立脚本以后chmod a+x backup.ramn后,还差点,转战shell下,虽然一直想把shell好好用,但是好像没什么进展。 今天开始看shell 当然首先出现的还是ls,最常用的是ls -l,ls -la包含的信息: total 4232:该目录中所有文件所占的空间。 - r w x r- x r- x:这是该文件的权限位。 前面的横杠有: d 目录。 l 符号链接(指向另一个文件)。 s 套接字文件。 b 块设备文件。 c 字符设备文件。 p 命名管道文件。 - 普通文件,或者更准确地说,不属于以上几种类型的文件。 如果除去最前面的横杠,这里一共是9个字符,他们对应9个权限位。通过这些权限位,可以设定用户对文件的访问权限。这9个字符可以分组: r w x:文件属主权限 这是前面三位r- x:同组用户权限 这是中间三位r- x:其他用户权限 这是最后三位 1 该文件硬链接的数目。 root 文件的属主。root 文件的属主r o o t所在的缺省组(也叫做r o o t )。 3578 用字节来表示的文件长度,记住,不是K字节!Oct 14 04:44 文件的更新时间。 dmesg 文件名。 - rw- r-- r-- 文件类型为普通文件 文件属主可以读、写 同组用户可以读 其他用户可以读r-- --- --- 文文件属主可读,但不能写或执行 r-- r-- --- 文文件属主和同组用户(一般来说,是文件属主所在的缺省组)可读 r-- r-- r- - 文任何用户都可读,但不能写或执行 rwx r-- r- - 文文件属主可读、写、执行,同组用户和其他用户只可读 rwx r-x --- 文文件属主可读、写、执行,同组用户可读、执行 rwx r-x r- x 文文件属主可读、写、执行,同组用户和其他用户可读、执行 rw- rw- --- 文文件属主和同组用户可读、写 rw- rw- r- - 文文件属主和同组用户可读、写,其他用户可读 rw- rw- --- 文文件属主和同组用户及其他用户读可以读、写,慎用这种权限设置,因为任何用户都可以写入该文件 chmod [who] operator [permission] filenamewho的含义是: u 文件属主权限。g 同组用户权限。o 其他...