17.08.17

控制文件

丢失部分控制文件:

SQL> select * from v$controlfile;

$ >/u01/app/oracle/oradata/orcl/control01.ctl

SQL> select * from v$tablespace;           报错

SQL> alter system checkpoint;                报错

$ vi /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log

SQL> shutdown abort

SQL> startup nomount

SQL> show parameter control_files

$ cp /u01/app/oracle/fast_recovery_area/orcl/control02.ctl /u01/app/oracle/oradata/orcl/control01.ctl

SQL> alter database mount;

SQL> alter database open;

丢失全部控制文件(有自动备份):

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

RMAN> backup datafile 4;

$ >/u01/app/oracle/oradata/orcl/control01.ctl

$ >/u01/app/oracle/fast_recovery_area/orcl/control02.ctl

SQL> select * from v$tablespace;           报错

SQL> alter system checkpoint;                报错

SQL> shutdown abort

SQL> startup nomount

RMAN> restore controlfile from autobackup;

RMAN> alter database mount;

RMAN> recover database;

RMAN> alter database open resetlogs;

丢失全部控制文件(没有自动备份):

SQL> alter database backup controlfile to ‘/home/oracle/control.bak‘;

SQL> alter database backup controlfile to trace;

SQL> select * from v$diag_info;

spfile

有自动备份:

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

RMAN> backup datafile 4;

联机恢复:

$ mv $ORACLE_HOME/dbs/spfileorcl.ora $ORACLE_HOME/dbs/spfileorcl.ora.bak

SQL> alter system set resource_limit=true;   报错

SQL> create spfile=‘/home/oracle/spfile.bak‘ from memory;

$ mv /home/oracle/spfile.bak $ORACLE_HOME/dbs/spfileorcl.ora

脱机恢复:

SQL> shutdown immediate

$ mv $ORACLE_HOME/dbs/spfileorcl.ora $ORACLE_HOME/dbs/spfileorcl.ora.bak

RMAN> startup

RMAN> restore spfile from ‘/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_10_26/o1_mf_s_894118741_c2vkgo8x_.bkp‘;

RMAN> startup force

没有备份:

利用alert_orcl.log中的参数值,构造initorcl.ora

SQL> create spfile=‘/home/oracle/spfile.bak‘ from pfile;

利用备份init.ora:

$ vi /u01/app/oracle/product/11.2.0/db_1/dbs/init.ora       完善参数

SQL> startup pfile=‘/u01/app/oracle/product/11.2.0/db_1/dbs/init.ora‘

SQL> create spfile from pfile;

redo log

丢失一个成员:

SQL> select GROUP#, MEMBERS from v$log;

SQL> select GROUP#, MEMBER from v$logfile;

SQL> alter database add logfile member ‘/home/oracle/redo01b.log‘ to group 1;

SQL> alter database add logfile member ‘/home/oracle/redo02b.log‘ to group 2;

SQL> alter database add logfile member ‘/home/oracle/redo03b.log‘ to group 3;

SQL> alter system switch logfile;

SQL> alter system switch logfile;

SQL> alter system switch logfile;

故障:

SQL> select group#, status from v$log;           确认current组

$ rm -f /home/oracle/redo02b.log                  删除current组成员

SQL> alter system switch logfile;

$ vi /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log      警告日志

恢复:

SQL> alter database drop logfile member ‘/home/oracle/redo02b.log‘;

SQL> alter database add logfile member ‘/home/oracle/redo02b.log‘ reuse to group 2;

如果是当前日志组,不能删除成员,只能先切换再修改

丢失inactive日志组:

故障:

SQL> alter system checkpoint;

SQL> select group#, status from v$log;           确认inactive组

SQL> shutdown abort

$ rm -f /home/oracle/redo03b.log /u01/app/oracle/oradata/orcl/redo03.log

$ startup          报错

恢复:

SQL> startup mount

SQL> select group#, status, archived from v$log;

SQL> alter database clear logfile group 3;

SQL> alter database open;

如果日志未归档:

SQL> alter database clear unarchived logfile group 3;

做数据库的全备份

丢失current日志组(正常关闭数据库):

故障:

SQL> select group#, status from v$log;           确认current组

SQL> shutdown immediate

$ rm -f /home/oracle/redo02b.log /u01/app/oracle/oradata/orcl/redo02.log

SQL> startup            报错

恢复:

SQL> startup mount

SQL> select group#, status , archived from v$log;

SQL> alter database clear unarchived logfile group 2;

SQL> alter database open;

做数据库的全备份

丢失current日志组(非正常关闭数据库):

故障:

RMAN> backup database;

SQL> create table t1(x varchar2(50));

SQL> insert into t1 values (‘after backup, before archived‘);

SQL> commit;

SQL> alter system switch logfile;

SQL> insert into t1 values (‘after backup, after archived, current‘);

SQL> commit;

SQL> insert into t1 values (‘after backup, after archived, current, uncommitted‘);

SQL> alter system checkpoint;

SQL> shutdown abort

$ rm -f /home/oracle/redo03b.log /u01/app/oracle/oradata/orcl/redo03.log

SQL> startup            报错

SQL> select group#, sequence#, status, archived from v$log;        确认日志序号

恢复:

RMAN> run {

startup force mount;

set until sequence 10;

restore database;

recover database;

alter database open resetlogs;}

SQL> select * from t1;              丢失数据

丢失active日志组:

恢复数据块

故障:

SQL> create tablespace tbs01 datafile ‘/home/oracle/tbs01.dbf‘ size 5M;

SQL> create table t1 tablespace tbs01 as select * from dba_objects where rownum<=30000;

RMAN> backup tablespace tbs01;

SQL> alter system flush buffer_cache;

$ dd of=/home/oracle/tbs01.dbf bs=8k conv=notrunc seek=300<<EOF

不截断      第300个数据块

SQL> select count(*) from t1;          报错

$ dbv file=‘/home/oracle/tbs01.dbf‘

恢复:

SQL> select file#, block# from v$database_block_corruption;

RMAN> recover datafile 6 block 300;

RMAN> recover corruption list;

DBMS_REPAIR包隔离数据块

rman恢复目录

SQL> show parameter control_file_record_keep_time

用dbca创建数据库rc(不配置em、fra,200M内存,字符集unicode)

或者:

用netca创建主机连接字符串rc指向自身。

rc:

$ sqlplus sys/[email protected] as sysdba

SQL> create tablespace rc_tbs datafile ‘/home/oracle/rc_tbs.dbf‘ size 50M;

SQL> create user rcowner identified by password default tablespace rc_tbs quota unlimited on rc_tbs;

SQL> grant recovery_catalog_owner to rcowner;

$ rman catalog rcowner/[email protected]

RMAN> create catalog;

$ rman target sys/[email protected] catalog rcowner/[email protected]

$ rman target / catalog rcowner/[email protected]

RMAN> register database;

dbca删除rc

时间: 2024-10-06 06:14:22

17.08.17的相关文章

2014年6月7日03:17:08

1 int i = 9; 2 Console.WriteLine("{0}", i == 1); 3 Console.WriteLine("{0}", i = 1); 4 Console.ReadKey(); 5 //输出falese和1. C#中赋值表达式也有值,它的值表示为赋值后变量的值 1 string s = Console.ReadLine(); 2 if (s == "1") 3 { 4 Console.WriteLine("

Intel Digital Innovation Industry Summit(2018.08.17)

时间:2018.08.17地点:北京金隅喜来登大酒店 原文地址:https://www.cnblogs.com/xuefeng1982/p/10331638.html

NOIP模拟17.8.17

NOIP模拟17.8.17 A 小 G 的字符串文件名 输入文件 输出文件 时间限制 空间限制str.pas/c/cpp str.in str.out 1s 128MB[题目描述]有一天,小 L 给小 G 出了这样一道题:生成一个长度为 n 的.全由小写英文字母构成的字符串,只能使用 k 种字母.要求满足:• 字符串中相邻的两个字母不能相同.• 必须出现恰好 k 种不同的字母.这样的合法字符串可能有很多,小 L 让小 G 输出字典序最小的那个.小 G 太笨啦,不会做这道题,希望你帮帮他.[输入格

08.17《jsp》——html+css+js+jsp+servlet+oracle简单项目练习

16,17号,两天时间,结束了JSP的学习,开始了项目的实践学习 第一步是最简单的添加 在这之中,对于数据库的链接,间接的展开了jdbc的复习,在其中由于数据库和老师所给的教材不相符,所以停顿在链接数据的时间很长,在一遍遍的修改ORA-12505错误没有结果的时候,使用最笨的办法重新安装了一个ORACLE数据库,将其命名与老师的同名,这样解决了数据库的链接失败问题. 第二步是查找操作 有了第一次的流程,所以这次速度快了一些,在一边完成查找操作的同时一边熟悉着流程,熟悉着数据流向的过程,由页面 -

我关注的一周技术动态2015.08.17

服务化和资源管理技术 1. Kubernetes技术分析之存储 http://dockone.io/article/556 要点: 众所周知,使用Docker的时候,容器中的数据是临时,即当容器销毁时,其中的数据时丢失.如果需要持久化数据,需要使用Docker Volume挂载宿主机上的文件目录到容器中.本文介绍了 kubernetes 支持的几种存储系统. 2. Docker 1.8:可信镜像.Toolbox.Registry 以及编排工具大更新 http://dockone.io/artic

17.08.29

1.in fuction xxx 指的是xxx没有赋值 2.关于该error 应将add函数放在main之前.

17.08.04

实例管理 监听 启动监听: $ netstat -tlnp | grep 1521 $ lsnrctl LSNRCTL> help $ lsnrctl status $ lsnrctl stop $ netstat -tln | grep 1521 快速动态注册:(可选) $ sqlplus / as sysdba SQL> alter system register; $ lsnrctl status em Emctl start | stop | status dbconsole 一个监听

17.08.12

调度作业 $ ps -ef | grep cjq SQL> show parameter job_queue_processes 后台预先设置的自动化管理作业: 自定义作业: SQL> create table session_history(snap_time timestamp with local time zone, num_session number); em中创建作业: 使用plsql块: declare session_count  number; begin select c

08.17 js 1 2 3 4回顾

2.简易计算机 3. 4. 5.