What are the commonly used SQL statements in DBA
DBA commonly used SQL statements, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
/ *
The CHUNKS column indicates how many free blocks are available in the table space (each free block is made up of contiguous Oracle blocks). If there are too many free blocks, for example, more than 100 per data file, then the table space is severely fragmented.
, /
Select tablespace_name
Count (*) chunks
Max (bytes/1024/1024) max_chunk
From dba_free_space
Group by tablespace_name
/ *
If you use the JOB to complete some scheduled jobs, check the operation of these JOB:
Select job,log_user,last_date,failures
From dba_jobs
If the FAILURES column is a number greater than 0, the JOB failed and needs to be further checked.
, /
Select job,log_user,last_date,failures from dba_jobs
/ *
DBA should regularly check the connection of the database to see if the number of sessions established with the database is normal. If too many connections are established, it will consume the resources of the database. At the same time, some "dead" connections may need to be manually cleaned by DBA.
Note that sessions with SID of 1 to 7 (USERNAME is listed as null) in the above example are background processes of Oracle, so do not do anything with these sessions.
, /
Select sid,serial#,username,program,machine,status
From v$session
/ *
DBA should regularly check the connection of the database to see if the number of sessions established with the database is normal. If too many connections are established, it will consume the resources of the database. At the same time, some "dead" connections may need to be manually cleaned by DBA.
Note: sessions with a SID of 1 to 7 (USERNAME is listed as empty) are background processes of Oracle. Do not do anything with these sessions.
, /
Alter system kill session 'SID,SERIAL#'
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.