Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used SQL statements in DBA

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report