Oracle Learning Notes-Preface

Source: Internet
Author: User

1. Direction of DBA Development: Business DBA, architect (course 13, may be the case, but also reference)

2, develop good habits: less use of graphical interface, multi-use Sqlplus

3. Remember common SQL statements:

Size of the query tablespace (the size of the table space is the size of the database (the log file is not counted))

Select Tablespace_name,sum (user_bytes) from Dba_data_files GROUP by Tablespace_name

Union

Select Tablespace_name,sum (user_bytes) from Dba_temp_files Group by Tablespace_name;

Querying the size of a data object

Select Segment_name,segment_type,bytes from User_segments where segment_name in (' T ', ' idx_t ');

Query the current SQL statement for the session (assuming SID is 68)

Select sid,status,sql_id from v$session where sid = 68;

Select Sql_text from v$sql where sql_id = ' * * *;

The process number of the query session (operating system level)

Select spid from v$process where addr = (select Paddr from v$session where sid = 68);

Querying for blocked sessions

Select Sid,lmode,type,request,block from V$lock where type in (' TX ', ' TM ') Order by 1, 3;

Output Execution Plan

Method One: Set Autotrace on (trace exp);--Do not execute SQL, output execution plan only

Method Two: Explain plan for SELECT * from t;--Generate execution plan

SELECT * FROM table (dbms_xplan.display);--Output execution plan

Trace SQL statements

Method one: Alter session set Sql_trace = true;--Subsequent trace a SQL statement is output to a trace file

METHOD Two: Alter session set event ' 10046 Trace name context forever,level n ';

4, multi-query documents (beginners are not recommended to read the official documents directly, because the focus is not clear, difficult to adhere to, should be more practice)

Tips

You can query errors directly with error ora in Linux or Unix

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.