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 common Linux commands in DBA

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

Share

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

This article mainly introduces which Linux commands are commonly used in DBA. It is very detailed and has a certain reference value. Friends who are interested must finish reading it!

1. Press oracleSID to query the client IP that connects to the database

Netstat-anpT | grep oracleSID | awk'{print $5}'| grep-o-E'1. Collect charge'| awk-F':'{print $1}'| sort

two。 Press listening port 1521 to query the client IP that connects to the database

Netstat-anpT | grep 1521 | awk'{print $5}'| grep-o-E'1. Print $1}'| awk-F':'{print $1}'| sort

3. Kill the process of the client that connects to the database oracleSID on the database server

Kill-9 `ps-ef | grep oracleSID | grep LOCAL=NO | grep-v grep | awk'{print $2}'`

4. Delete all processes under a user's userA

Pkill-9-u userA

5. Query the number of process processes connected to port 1521

Netstat-pan | grep 1521 | wc-l

6. Query the number of process processes connected from a server 192.168.21.15

Netstat-pan | grep 192.168.21.15 | wc-l

7. Summarize the number of connections per client IP connected to port 1521

Netstat-apnT | grep 1521 | awk'{print $5}'| sort-u | grep-v 1521 | grep-v'*'| awk-F':'{print $4}'| uniq-c | sort-nrnetstat-anpT | grep 1521 | awk'{print $5}'| grep-o-E'1} | awk-F':'{print $1}'| sort | uniq-c | sort-nr

8. Show the top 10 files or directories that take up the most space

Du-s * | sort-nr | head

9. Count the total size of all files on a given day

Ls-- full-time `find. / *-name "log_*.bak" `| grep '2016-05-09' | awk' {print $9}'| xargs du-ck

10. Delete files from a few days ago

Find / mitac/mds/arch/-ctime + 150-exec rm-rf {}\;-- commonly used find / mitac/mds/arch/-name'* 836701255.dbf'-ctime + 150-exec rm-rf {}\;-- Delete files that end with 836701255.dbf and were modified 150 days ago

11. The top 10 processes occupied by CPU:

Ps auxw | head-1 | PS auxw | sort-rn-K3 | head-10

twelve。 Top 10 processes with the most memory consumption

Ps auxw | head-1 | PS auxw | sort-rn-K4 | head-10

13. Top 10 processes with the most virtual memory usage

Ps auxw | head-1 cpu PS auxw | sort-rn-K5 | after head-10 top, press 1 to see how many cpu you can see, sort by cpu by shift+p, and sort by memory by shift+m

14. Vi replaces all strings, as follows, replace 1 with 2

:% sAccord 1Compact 2Compact g

15. Check the IO information, which is displayed as follows every 1 second, for a total of 3 times, as MB

Iostat-d-x-m 1 3

16. Check how long it takes for a cp file to file1 to the / U01 directory

Time cp file1 / u01/

17. Check the usage of CPU during a certain period of time, such as 7:00 to 9:00

Sar-s 07:00:00-e 10:00:00

The above is all the contents of the article "what are the Linux commands commonly used in DBA?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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