配置可恢复性:
ontrol_files:控制文件
parameter:参数
show:显示
select name from v$database; 查看当前的数据库★★
控制文件
SQL> show parameter control_files
SQL> select * from v$controlfile;
修改路径:
$ cd $ORACLE_HOME/dbs 改变目录位置
$ cp spfileorcl.ora spfileorcl.ora.bak 备份
SQL> alter system set control_files='/u01/app/oracle/oradata/orcl/control01.ctl', '/home/oracle/control02.ctl' scope=spfile;
SQL> shutdown immediate
$ mv /u01/app/oracle/fast_recovery_area/orcl/control02.ctl /home/oracle/control02.ctl
SQL> startup
SQL> show parameter control_files 显示控制文件的参数,路径
SQL> select * from v$controlfile; 更详细的查询
增加镜像:
SQL> alter system set control_files='/u01/app/oracle/oradata/orcl/control01.ctl', '/home/oracle/control02.ctl', '/home/oracle/control03.ctl' scope=spfile;
SQL> shutdown immediate
$ cp /home/oracle/control02.ctl /home/oracle/control03.ctl
SQL> startup
SQL> show parameter control_files
SQL> select * from v$controlfile;
system:系统
如果重启数据库以后出现250,则路径有问题,需检查
路径添加需要一个单引号 ' 结尾也要有' 两个路径之间则用 ,隔开 紧挨着下一个路径也要用单引号 ' 结尾一样是 ' 最后;
logfile:日志文件
member:成员
log:日志
data:数据
select name from v$datafile 查询数据文件
日志文件:
增加成员和日志组:
SQL> select GROUP#, SEQUENCE#, STATUS, 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 database add logfile group 4 ('/u01/app/oracle/oradata/orcl/redo04.log',
开启归档模式:
SQL> archive log list 检查当前设置
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list
SQL> show parameter log_archive_dest
SQL> select group#, sequence#, status, archived from v$log;
SQL> alter system switch logfile; 日志切换,对当前日志归档
SQL> select group#, sequence#, status, archived from v$log;
SQL> select NAME, SEQUENCE#, STATUS from v$archived_log;
$ ls /u01/app/oracle/fast_recovery_area/ORCL
RMAN配置:
$ rman target / 或rman target sys/password@orcl
RMAN> show all; 查看系统里面备份所有的配置
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP On;打开控制文件自动备份
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP clear;恢复默认
RMAN> backup tablespace users;
RMAN> list backup;
指定备份格式:
RMAN> backup tablespace users; 生成标准备份集
RMAN> backup as compressed backupset tablespace users; 生成压缩备份集
RMAN> backup as copy tablespace users; 生成镜像文件备份集
RMAN> list backup of tablespace users; 查看备份信息
RMAN> list copy of tablespace users;