常用命令
ORACLE
[custhn02:oracle:/oracle/app] echo $ORACLE_HOME
/oracle/app/oracle/12.1.0
[custhn02:oracle:/oracle/app] echo $ORACLE_BASE
/oracle/app/oracle
GRID
[custhn02:grid:/home/grid] echo $ORACLE_HOME
/oracle/app/12.1.0/grid
[custhn02:grid:/home/grid] echo $ORACLE_BASE
/oracle/app/grid
AIX
df -k|egrep "oracle|u01|back"|awk '{print $7,$2/1024/1024,$3/1024/1024,$4}'|tr ' ' ' '
HPUNIX
bdf |egrep "oracle|u01|backup|rman"|tr -s ' '|cut -d ' ' -f2,3,4,5,6|grep -v dev|awk '{print $5,$1/1024/1024,$3/1024/1024,$4}'|tr ' ' '\t'|egrep ^'/'
/oracle/app/12.1.0/grid/rdbms/audit
1.TOOLS目录
du -sk /oracle/tools/oswbb/archive/oswps
find /oracle/tools/oswbb/archive/oswps -mtime +2 -type f|xargs rm
2.CVUREPORT
du -sk /oracle/app/grid/crsdata/@global/cvu/baseline/cvures
find /oracle/app/grid/crsdata/@global/cvu/baseline/cvures -mtime +7 -type f|xargs rm
3.GRID DIAG (重要,备份)
du -sk /oracle/app/grid/diag/crs/custhn02/crs
du -sk /oracle/app/grid/diag/asm/+asm/+ASM2
4.GRID AUDIT
du -sk /oracle/app/12.1.0/grid/rdbms/audit
find /oracle/app/12.1.0/grid/rdbms/audit -mtime +7 -type f|xargs rm
5.GRID LISTENER
du -sk /oracle/app/grid/diag/tnslsnr/
5.ORACLE DIAG(重要,备份)
du -sk /oracle/app/oracle/diag
du -sk /oracle/app/oracle/diag/rdbms/custdb/custdb2
6.ORACLE AUDIT
du -sk /oracle/app/oracle/admin/
find /oracle/app/oracle/admin/thradb/adump -type f -mtime +7 -exec rm {} \;
find /oracle/app/oracle/admin/thradb/adump/ -type f -mtime +7 -name "*.aud" -exec rm {} \;
7.关键表备份
SQL> set linesize 150;
set pagesize 20;
column name format a13;
column value format a20;
column unit format a30;
column TIME_COMPUTED format a30;
select name,value,unit,time_computed from v$dataguard_stats where name in ('transport lag','apply lag');
set linesize 150;
column DBNAME format a6;
column DBUNAME format a10;
column cftype format a8;
column OPEN_MODE format a20;
column DATABASE_ROLE format a18;
select name dbname,db_unique_name dbuname,controlfile_type cftype,database_role,open_mode from v$database;
SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
开启日志应用进程:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
Database altered.
SQL>
#############################################################################################
备库查询:
SQL> SELECT RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS WHERE DEST_ID=1;
RECOVERY_MODE
---------------------------------------------------------------------
MANAGED REAL TIME APPLYs
取消日志应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;