Oracle DBA运维常用命令小贴士

Oracle · ruyi · 于 1年前发布 · 1074 次阅读

查看当前数据库SCN号

select to_char(current_scn) from v$database;

切换日志文件

alter system switch logfile ;   

查看日志文件和状态

 select group#,members,status from v$log;
 select group#,status,member from v$logfile;

表空间添加数据文件

select file_name,tablespace_name from dba_data_files where tablespace_name='WMS_DATA';

alter tablespace WMS_DATA add datafile '/data1/oracle/oradata/wmssh6/wms_data_128.dbf' size 20G;
alter tablespace WMS_DATA add datafile '/data1/oracle/oradata/wmssh6/wms_data_129.dbf' size 20G;
alter tablespace WMS_DATA add datafile '/data1/oracle/oradata/wmssh6/wms_data_130.dbf' size 20G;
alter tablespace WMS_DATA add datafile '/data2/oracle/oradata/wmssh6/wms_data_131.dbf' size 20G;

创建standby controlfile

alter database create standby controlfile as '/tmp/control2.ctl';

dataguard应用日志和停止应用

alter database recover managed standby database disconnect;
alter database recover managed standby database cancel;
alter database open;
alter database recover managed standby database using current logfile disconnect;

设置dataguard延迟应用日志

alter database recover managed standby database disconnect from session delay 600;

更改dg配置

alter system set log_archive_config='DG_CONFIG=(std02,tmsstd,tms51)'scope=both; 
alter system set log_archive_dest_2='service=std02 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=std02' ; 

查看主备库switchover_status

SELECT SWITCHOVER_STATUS FROM V$DATABASE;

查看和重置原型

$ rman target/
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORATEST  3415512951       CURRENT 1          19-MAY-15
2       2       ORATEST  3415512951       ORPHAN  1460028    11-AUG-15

RMAN> reset database to incarnation 2;

如果这篇文章对您有帮助,不妨微信小额赞助我一下,让我有动力继续写出高质量的帖子。

共收到 0 条回复 oracle DBA 常用命令
没有找到数据。
回复本帖 (需要登录)