How Oracle Views Log ____oracle

Source: Internet
Author: User
Oracle Log View one.

Path to Oracle log: Login: Sqlplus "/as sysdba" View path:sql> select * from V$logfile; Sql> select * from V$logfile; (#日志文件路径) two. What does the Oracle log file contain: (the number of logs may be slightly different) Control01.ctl example01.dbf redo02.log sysaux01.dbf undotbs01.dbf control02.ctl . log system01.dbf users01.dbf control03.ctl redo01.log shttest.dbf temp01.dbf three. Oracle Log Viewing methods: Sql>select * from V$sql (#查看最近所作的操作) sql>select * fromv $sqlarea (#查看最近所作的操作) All changes to the Oracle database are recorded in the In the log, the only way to analyze Oracle logs at this point in time is to use the Logminer provided by Oracle companies, because the original log information is simply beyond our grasp, oracle8i in subsequent releases, Logminer, 

And Logminer is the tool that lets us read the log information, through this tool can: identify the logical change of the database, detect and correct the user's misoperation, perform the post audit, perform the change analysis. Four Logminer use: 1, create data dictionary file (data-dictionary) 1. First in the Init.ora initialization parameter file, add a parameter utl_file_dir that is the directory where the data dictionary files are placed on the server.

such as: Utl_file_dir = ($ORACLE _home\logs), restart the database, so that the new parameters to take effect: sql> shutdown;

sql>startup; 2). Then create the data dictionary file sql> connect/as sysdba sql> execute dbms_logmnr_d.build (dictionary_filename => ' Dict.ora '), Dictionary_location => '/data1/oracle/Logs '); Pl/sql procedure successfully completed 2, create a list of log files to parse 1). Create an analysis list, which is the log to parse Sql>execute DBMS Logmnr.add Logfil 
     E (logfilename => '/data1/oracle/oradata/akazamdb/redo01.log ', Options => dbms_logmnr.new); Pl/sql procedure successfully completeds 2). Add an analysis log file, add 1 more than one time Sql>execute Dbms_, logmnr.add_ logfile (logfil ename => '/data1/oracle/oradata/akazamdb/redo01.log ', Options => DBMS_LOGMNR. 
     AddFile); Pl/sql procedure successfully completed 3, use Logminer for log analysis (specifically to query what content can be modified) (1) Unrestricted sql> EXECUTE Dbms_logmnr.start 
_LOGMNR (dictfilename=> '/data1/oracle/logs/v816dict.ora '); (2) Restricted conditions are DBMS_ LOGMNR through the process. You can narrow the range of log files you want to analyze by setting several different parameters in START_LOGMNR. By setting the start time and termination time parameters, we can limit the logs that analyze only a certain time range. As the following example, we only analyze the September 18, 2007 log: Sql> EXECUTE dbms_logmnr.start_logmnr (dictfilename => '/data1/oracle/logs/ V816dict.ora ', StartTime => to_date (' 2007-9-18 00:00:00 ', ' yyyy-mm-dd HH24:MI:SS ') endtime => (' 2007-9-18 23:59:59 ', ' Yyyy-mm-dd hh24:mI:ss ')); You can also limit the scope of the log to be parsed by setting the start SCN and up to SCN: sql> EXECUTE DBMS_LOGMNR.START_LOGMNR (dictfilename => '/data1/oracle/logs/ 
V816dict.ora ', Startscn =>, ENDSCN => 50); 4. Observe the analysis results (v$logmnr_contents) So far, we have analyzed the contents of the Redo log file.
Dynamic performance View V$logmnr_contents contains all the information that Logminer analysis obtains. 
SELECT Sql_redo from V$logmnr_contents;
If we just want to know what a user is doing with a table, you can get it from the following SQL query, which can get all the work the user db_zgxt on the table SB_DJJL. 
Sql> SELECT Sql_redo from v$logmnr_contents WHERE username= ' db_zgxt ' and tablename= ' SB_DJJL '; It should be emphasized that the results of the analysis in the view v$logmnr_contents only exist during the life of the session we are running ' DBMS_LOGMRN.START_LOGMNR '.
This is because all Logminer storage is in PGA memory, all other processes are not visible to it, and as the process ends, the analysis results disappear. Finally, use the process DBMS_LOGMNR.
END_LOGMNR terminates the log parsing transaction, at which point the PGA memory area is cleared and the analysis results are no longer present.                       5, view Logminer tool analysis Results sql> SELECT * from Dict t where t.table_name like '%logmnr% ';-See all LOGMNR-related views table_name COMMENTS-------------------------------------------------------------------------------------------------- ------------gv$logmnr_callback synonym for gv_$Logmnr_callback gv$logmnr_contents synonym for gv_$logmnr_contents gv$logmnr_dictionary Synony                   M for gv_$logmnr_dictionary gv$logmnr_logfile synonym for Gv_$logmnr_logfile gv$logmnr_logs               Synonym for gv_$logmnr_logs gv$logmnr_parameters synonym for Gv_$logmnr_parameters gv$logmnr_process Synonym for gv_$logmnr_process gv$logmnr_region synonym for Gv_$logmnr_region gv$logmnr_sessi On synonym to gv_$logmnr_session gv$logmnr_stats synonym for Gv_$logmnr_stats gv$logmnr_t Ransaction synonym for gv_$logmnr_transaction v$logmnr_callback synonym for V_$logmnr_callback V $LOGMNR _contents synonym for v_$logmnr_contents v$logmnr_dictionary synonym for V_$logmnr_dicti Onary v$logmnr_logfile synonym for v_$logmnr_logfile v$logmnr_logs synonym for V_$LOGM Nr_logs V$logmnr_parameters synonym for v_$logmnr_parameters v$logmnr_process synonym for v_$logmnr_process v$logmn R_region synonym for v_$logmnr_region v$logmnr_session synonym for V_$logmnr_session TAB Le_name COMMENTS---------------------------------------------------------------------------------             -----------------------------v$logmnr_stats synonym for V_$logmnr_stats v$logmnr_transaction Synonym for V_$logmnr_transaction gv$logmnr_logs is the analysis Log List view analysis results in Gv$logmnr_contents view, you can query by following statement: Select Scn,timesta mp,log_id,seg_owner,seg_type,table_space,data_blk#,data_obj#,data_objd#, Session#,serial#,username,session_info 
, Sql_redo,sql_undo from Logmnr3 t where T.sql_redo like ' create% '; If you cannot query the gv$logmnr_contents view correctly, and report the following error, ORA-01306: DBMS_LOGMNR.START_LOGMNR () must be invoked before selecting from V$logmnr_contents.

 The following methods can be used: CREATE TABLE LOGMNR3 as SELECT * from Gv$logmnr_contents;

Oracle Ports: 1521

Reproduced from: http://blog.csdn.net/jerrydreamer/article/details/40375491

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.