All technological notes.
Automatic Diagnostic Repository (ADR)
Stores database diagnostic data such as:
Typical installations will have the ADR_BASE set to the ORACLE_BASE:
echo $ORACLE_BASEshow parameter diagnostic_dest
<adr_base>/diag/product_type/db_id/instance_id/
V$DIAG_INFO:
SELECT name, value FROM v$diag_info;

alert log:
alert log includes:
initialization parameter used at startup.can view the alert log by text editor or using ADRCI
Importance Files:
adr_home/alert/log.xml: XML formatadr_home/trace/alert_orcl.log: text formatlog.xml file using gedit

trace diralert_orcl.log file using gedit



adrci
show alert


Search the last time to start up an instance




:q
Trace File contain:
server and background process can write to an aasociated trace file.
background process:
orcl_dbw0_27147.trcserver process:
orcl_ora_3341.trcjob queue process.incident number is assigned to the error.ADR.ADR files can be automatically purged with retention policy parameters.自动删除.
<adr_home>/trace<adr_home>/incident
# set home path
set HOMEPATH diag/rdbms/orcl/orcl
# query the size policy for adr
select sizep_policy from adr_control_aux;
# query the short and long policy
# return the number in hours, 30days, 365 days.
select shortp_policy, longp_policy from adr_control;

# return an estimate for a size policy
estimate ( sizep_policy =200000000);
# return an estimate for a short and long policy, 8 days
estimate (shortp_policy =192, longp_policy=192);

set control (SHORTP_POLICY = 192);
set control (LONGP_POLICY = 192);
set control (SIZEP_POLICY = 8559020);
select shortp_policy, longp_policy from adr_control;
select sizep_policy from adr_control_aux;

cd /u01/app/oracle/diag/rdbms/orcl/orcl
# return the size of dir
du -hs

#[-size <bytes>]: Purge diagnostic data from the ADR home until the size of the home reaches <bytes> bytes.
purge -size 5000000 # purge until 5M

DDL log
Before enabling
/u01/app/oracle/diag/rdbms/orcl/orcl/log/ddl
enable_ddl_logging to true for the current sessionshow con_name
ALTER session SET container=orclpdb;
show con_name
show parameter enable_ddl_logging;
ALTER session SET enable_ddl_logging=true;
show parameter enable_ddl_logging;

CREATE TABLE test ( n number);
CREATE TABLE test1 ( n number);
DROP TABLE test;
DROP TABLE test1;


show alert -p "message_text like '%terminating the instance%'"
show alert -p "message_text like '%Beginning crash recovery%'"
show alert -p "message_text like '%Started redo scan%'"
show alert -p "message_text like '%Completed crash recovery%'"
show alert -p "message_text like '%db_recovery_file_dest_size%'"
terminating the instance