跳至主要内容

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

繁忙的周末

回了杭州,周五跟老爹吃夜宵,周六跟一群人玩,好乐迪9折加对折,然后夜宵,长肉。 跟老妈逛街。。花了我一千大洋,买了2件外套了受不了了。 结果。。唉。。去赶火车结果没坐上,改签,跟老妈发脾气。。让我多睡了10分钟结果拉下了火车。 然后做七点四十七的车,一路出战一路狂奔赶地铁。。 终于赶上了。 真不容易,还是要提早啊

mod

apache安装后,如果想再添加模块,往往不想重新安装一次,再者,我在安装中发现,并不是安装文件中所有的modules都会被默认安装,即使在安装中使用了 ./configure --prefix=/usr/local/apache --enable-so --enable-modules=all --enable-mods-shared=all也是如此。我使用上述方法安装的apache2.2.6就没有安装proxy相关模块。这时,需要手工生成so文件,但会自动的被复制到你的apache安装目录的modules中,然后修改apache的配置文件,加载相关模块,验证apache配置并重启服务即可。以上描述的具体操作步骤如下: 操作系统:linux redhat 4.5 ES apache版本:2.2.6 可自行下载tar包 1. 拷贝安装包到/usr/local,并在目标目录下进行解压。[root@localhost local]# cd /usr/local[root@localhost local]# tar -zxvf httpd-2.2.4.tar.gz2. 配置安装参数,安装的目标目录为/usr/local/apache,建议设置enable-mods-shared=all,不用的module注释掉就行了![root@localhost local]# cd httpd-2.2.4[root@localhost httpd-2.2.4]# ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all3. 编译并安装。[root@localhost httpd-2.2.4]# make[root@localhost httpd-2.2.4]# make install4. 启动Apache,并测试。[root@localhost httpd-2.2.4]# cd /usr/local/apache/bin[root@localhost bin]# ./apachectl start 打开浏览器,并在地址栏中输入主机的IP地址如 http://192.168.1.254/ 如果出现以下画面则说明安装成功。It works! 注意:安装完成后检查系统服务中的HTTPD服务是否已...