当前位置:网站首页>Summary of common operation and maintenance commands

Summary of common operation and maintenance commands

2022-07-03 20:51:00 Scenery Xiaolei

One . linux Common commands

  see linux System version

 Mode one : lsb_release -a
 If the command is not found, use the command to install :yum install -y redhat-lsb
 Mode two :cat /etc/redhat-release ( Apply to RedHat、CentOS)
 Mode three :cat /etc/issue
remarks : Display the following information as CentOS
0

Firewall related

remarks :CentOS7 The firewall configuration of is very different from the previous version , The default is firewall, Use with previous versions iptables Dissimilarity

 CentOS7 

 View firewall status  :firewall-cmd --state
 notes :running—— Turn on ,not running —— close 
 Turn on the firewall :systemctl start firewalld.service
 Turn off firewall :systemctl stop firewalld.service
 Turn off startup :systemctl disable firewalld.service
 Turn on the power and start :systemctl enable firewalld.service

 CentOS6

service The way :
 View firewall status :service iptables status
 Turn on the firewall :service iptables start
 Turn off firewall : service iptables stop
iptables The way :
 Enter the first init.d Catalog , The order is as follows :
[[email protected] ~]# cd /etc/init.d/ [[email protected] init.d]#
 View firewall status :
[[email protected] init.d]# /etc/init.d/iptables status
 Turn off the firewall temporarily :
[[email protected] init.d]# /etc/init.d/iptables stop
 restart iptables:
[[email protected] init.d]# /etc/init.d/iptables restart

Release linux cache

sync && echo '1' > /proc/sys/vm/drop_caches
sync && echo '2' > /proc/sys/vm/drop_caches
sync && echo '3' > /proc/sys/vm/drop_caches

sync:  Write all unwritten system buffers to disk , Include modified  i-node、 Delayed block  I/O  And read-write mapping files . Otherwise, in the process of releasing the cache , You may lose unsaved files 

0 –  Don't release 
1 –  Free page cache 
2 –  Release dentries and inodes
3 –  Free all caches 

Linux Log view

 Output the log of a certain time period in the log file to a new file 
  sed -n '/2019-04-22 16:10:/,/2019-04-22 16:20:/p' log.log > bbb.txt
 Find the number of lines before and after keywords in a log file 
  cat filename | grep  keyword  -C10   -C: How many lines are displayed before and after  -A: How many lines are displayed after  -B: Show how many lines before 

View port usage

--  Check the port status 
   netstat -tnulp | grep 26379
-- linux  View port usage 
  netstat -anp | grep 80
--  Port information used by the current environment 
  netstat -nultp
--  The command was not found. Use the following installation 
  yum -y install net-tools

Linux Timing task

#linux Timing task :
  service crond start // Start the service  
  service crond stop // Close the service 
  service crond restart // Restart the service  
  service crond reload // service crond reload  
  service crond status // see crontab Service status 
# install crond
  yum -y install vixie-cron yum -y install crontabs
# chkconfig mysqld on 
  chkconfig –level 345 crond on
# restart rsyslog
# restart cronlog( No log output with this )
  sudo service rsyslog restart
 Log location : /var/log/cronXXX
# View tasks
  crontab -l
# Editing task
  crontab -e

Command time format : * * *  *  *  command branch   when   Japan   month   Zhou  
The first 1 List minutes 1~59 Per minute * perhaps */1 Express
The first 2 List hours 1~23(0 Express 0 spot ) The first 3 List date 1~31 The first 4 List month 1~12 The first 5 Column ID week 0~6(0 Sunday ) The first 6 Column command to run
some Crontab Examples of scheduled tasks :
30 21 * * * /usr/local/etc/rc.d/lighttpd restart # Every night 21:30 restart apache
45 4 1,10,22 * * /usr/local/etc/rc.d/lighttpd restart # monthly 1、10、22 Japanese 4 : 45 restart apache
10 1 * * 6,0 /usr/local/etc/rc.d/lighttpd restart # Every Saturday 、 Sunday's 1 : 10 restart apache
0,30 18-23 * * * /usr/local/etc/rc.d/lighttpd restart # Every day 18 : 00 to 23 : 00 Between every 30 Minutes to restart apache
0 23 * * 6 /usr/local/etc/rc.d/lighttpd restart # Every Saturday 11 : 00 pm restart apache
* 23-7/1 * * * /usr/local/etc/rc.d/lighttpd restart # evening 11 Point to morning 7 Between points , Restart every hour apache
* */1 * * * /usr/local/etc/rc.d/lighttpd restart # Restart every hour apache
0 11 4 * mon-wed /usr/local/etc/rc.d/lighttpd restart # Monthly 4 Day and Monday to Wednesday every week 11 Click restart apache
0 4 1 jan * /usr/local/etc/rc.d/lighttpd restart # On January 1st 4 Click restart apache
*/30 * * * * /usr/sbin/ntpdate cn.pool.ntp.org # Synchronize the time every half an hour
0 */2 * * * /sbin/service httpd restart # Restart every two hours apache
50 7 * * * /sbin/service sshd start # Every day 7:50 Turn on ssh service
50 22 * * * /sbin/service sshd stop # Every day 22:50 close ssh service
0 0 1,15 * * fsck /home # monthly 1 Number and 15 No. check /home disk
1 * * * * /home/bruce/backup # The first minute of every hour /home/bruce/backup This file
00 03 * * 1-5 find /home "*.xxx" -mtime +4 -exec rm {} \; # From Monday to Friday every week 3 O 'clock , In the catalog /home in , Find the file name *.xxx The file of , And delete 4 Documents before .
30 6 */10 * * ls # Monthly 1、11、21、31 Day yes 6:30 Do it once ls command

 nfs mount

#  Check the mount disk 
cat /etc/fstab
#  Re mount 
mount -a

 

Two . Docker Common commands

  see docker List of containers :

docker ps

  Check the log

 Log view syntax :
docker logs [OPTIONS] CONTAINER
OPTIONS explain :
-f :  Trace log output 
--since : Show all logs for a start time 
-t :  Display time stamp 
--tail : List only the latest N Container log 
 View log command :docker logs -f  Containers ID
 Real time view of the last 500 Logs :docker logs -f --tail=500  Containers ID
 Look at the recent 30 Minute log :docker logs --since 30m  Containers ID
 Check the latest log after a certain time 500 Logs :docker logs --since="2021-11-30" --tail=500  Containers ID
 Check the log after a certain time :docker logs -t --since="2021-11-30T00:00:00"  Containers ID
 Check the log of a certain period of time :docker logs -t --since="2021-11-30T00:00:00" --until "2021-12-30T00:00:00"  Containers ID

Image export import

#  Export image to file 
$ docker save -o nginx-alpine.tar nginx:alpine
#  Import mirror 
$ docker load -i nginx-alpine.tar

Image delete

--  Delete the specified image 
docker rmi --force [-f] $(docker images | grep tarzan-mes | grep "7 months"| awk '{print $3}')
--  Delete the unlabeled image 
docker rmi [-f] $(docker images -q | awk '/^<none>/ { print $3 }')
-- Delete all images 
docker rmi [-f] $(docker images -qa)
 This kind of unlabeled image is also called   A false image (dangling image) , You can use the following command to display this kind of image specifically :
docker image ls -f dangling=true
 Generally speaking , The mirror image has lost its value of existence , It can be deleted at will , You can use the following command to delete .
docker rmi $(docker images -q -f dangling=true)

Mirror operation

docker build . -t hzero-register:v200 -f ./../src/main/docker/Dockerfile
docker tag hzero-register:v200 k8s1.cluster.local:5000/hzero-register:v200
docker push k8s1.cluster.local:5000/hzero-register:v200

3、 ... and . K8s command

remarks :uat refer to namspase ,mes-interface-7bbf6d64c9-88dhw refer to pod name
 
Get into pod Internal execution order : kubectl exec -it uat -n mes-interface-7bbf6d64c9-88dhw -- /bin/bash
[[email protected]~]#kubectl -n mes-pro cp./jdk-8u291-linux-x64.tar.gz tarzan-mes-69994cdfdb-kfg96:/jdk.tar.gz
[[email protected]-prd-k8s1 ~]kubectl -n mes-pro exec -it tarzan-mes-69994cdfdb-kfg96 -/bin/bash

Log correlation

 View a certain pod Previous version log :kubectl logs -p -n mes-pro tarzan-mes-6bd4bf5b79-xmkgk
 see pod Last exit details :kubectl describe pod tarzan-mes-864bcbcd46-gw5zm -n mes-pro
k8s Node installation arthas :
kubectl -n uat exec mes-interface-7bbf6d64c9-88dhw -- wget https://arthas.aliyun.com/arthas-boot.jar && java -jar arthas-boot.jar 1
 remarks : final 1 Is a process, 
take pod The logs in are copied to the host
kubectl exec -n service tarzan-mes-c75587bfc-jpjp9 -- tar cf - data/tarzan/mes/tarzan-mes-2022-05-15.0.log | tar xf - -C /tmp

pod It contains telnet

apt update
apt install telnet

Other common commands

kubectl get po -A
kubectl get nodes
kubectl get pod -A -o wide kubectl describe nodes wmsdevelapp kubectl taint node wmsdevelapp node.kubernetes.io
/unschedulable:NoSchedule- kubectl top pod -n mesuat journalctl -u kubelet.service -- kubectl taint nodes 192.168.0.137 key1=value1:NoSchedule-

 

Four 、Mysql

View the transaction being locked

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;

View transactions waiting for locks

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;

Inquire about Ongoing transactions

SELECT * FROM information_schema.INNODB_TRX;

Inquire about mysql Processes that exist in the database

select * from information_schema.`PROCESSLIST`(show processlist;)

Kill thread

 kill  Threads id 

clear through InnoDB_row_lock State variables are used to analyze the contention of row locks on the system

show status like 'innodb_row_lock%';

 The description of each status is as follows :

Innodb_row_lock_current_waits: The number of locks currently waiting ;

Innodb_row_lock_time: The total length of time from system startup to lock up ;

Innodb_row_lock_time_avg: The average time it takes to wait ;

Innodb_row_lock_time_max: The longest waiting time from system startup to now ;

Innodb_row_lock_waits: The total number of times the system has been waiting since it was started ;

 For this 5 Two state variables , Here's the important thing :

Innodb_row_lock_time_avg,Innodb_row_lock_waits,Innodb_row_lock_time.

 Especially when waiting times are high , And every time I wait for a long time , We need to analyze why there are so many waiting in the system , Then according to the analysis results to formulate optimization .
select @a1:=VARIABLE_VALUE as a1
from information_schema.GLOBAL_STATUS
where VARIABLE_NAME='innodb_os_log_written'
union all
select sleep(60)
union all
select @a2:=VARIABLE_VALUE as a2
from information_schema.GLOBAL_STATUS
where VARIABLE_NAME='innodb_os_log_written';

select round((@a2[email protected])/1024/1024/@@innodb_log_files_in_group) as MB;


--------------------

SELECT
p2.`HOST` Blockedhost,
p2.`USER` BlockedUser,
r.trx_id BlockedTrxId,
r.trx_mysql_thread_id BlockedThreadId,
TIMESTAMPDIFF(
SECOND,
r.trx_wait_started,
CURRENT_TIMESTAMP
) WaitTime,
r.trx_query BlockedQuery,
l.lock_table BlockedTable,
m.`lock_mode` BlockedLockMode,
m.`lock_type` BlockedLockType,
m.`lock_index` BlockedLockIndex,
m.`lock_space` BlockedLockSpace,
m.lock_page BlockedLockPage,
m.lock_rec BlockedLockRec,
m.lock_data BlockedLockData,
p.`HOST` blocking_host,
p.`USER` blocking_user,
b.trx_id BlockingTrxid,
b.trx_mysql_thread_id BlockingThreadId,
b.trx_query BlockingQuery,
l.`lock_mode` BlockingLockMode,
l.`lock_type` BlockingLockType,
l.`lock_index` BlockingLockIndex,
l.`lock_space` BlockingLockSpace,
l.lock_page BlockingLockPage,
l.lock_rec BlockingLockRec,
l.lock_data BlockingLockData,
IF (p.COMMAND = 'Sleep', CONCAT(p.TIME,' seconds'), 0) idel_in_trx
FROM
information_schema.INNODB_LOCK_WAITS w
INNER JOIN information_schema.INNODB_TRX b ON b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.INNODB_TRX r ON r.trx_id = w.requesting_trx_id
INNER JOIN information_schema.INNODB_LOCKS l ON w.blocking_lock_id = l.lock_id AND l.`lock_trx_id`=b.`trx_id`
INNER JOIN information_schema.INNODB_LOCKS m ON m.`lock_id`=w.`requested_lock_id` AND m.`lock_trx_id`=r.`trx_id`
INNER JOIN information_schema. PROCESSLIST p ON p.ID = b.trx_mysql_thread_id
INNER JOIN information_schema. PROCESSLIST p2 ON p2.ID = r.trx_mysql_thread_id
ORDER BY
WaitTime DESC;

--------------

00:0c:29:b3:b7:36 brd ff:ff:ff:ff:ff:ff

SELECT
p2.`HOST`  Blocked party host,
p2.`USER`  Blocked user ,
r.trx_id  Blocked party transactions id,
r.trx_mysql_thread_id  Blocked party thread number ,
TIMESTAMPDIFF(
SECOND,
r.trx_wait_started,
CURRENT_TIMESTAMP
)  Waiting time ,
r.trx_query  Blocked queries ,
l.lock_table  Blocking side locked table ,
m.`lock_mode`  Lock mode of blocked party ,
m.`lock_type` " The lock type of the blocked party ( Table lock or row lock )",
m.`lock_index`  The index locked by the blocking party ,
m.`lock_space`  The blocked party locks the object space_id,
m.lock_page  The number of pages locked by blocked party transactions ,
m.lock_rec  The number of rows locked by the blocked party transaction ,
m.lock_data  The primary key value of the blocked transaction lock record ,
p.`HOST`  Blocking host ,
p.`USER`  Blocking user ,
b.trx_id  Blocking party transactions id,
b.trx_mysql_thread_id  Blocking party thread number ,
b.trx_query  Blocking party query ,
l.`lock_mode`  Blocking side lock mode ,
l.`lock_type` " Lock type of blocking party ( Table lock or row lock )",
l.`lock_index`  Blocked index ,
l.`lock_space`  Blocking side lock object space_id,
l.lock_page  The number of blocked transaction lock pages ,
l.lock_rec  The number of blocked transaction lock rows ,
l.lock_data  The primary key value of the blocking party transaction lock record ,
IF (p.COMMAND = 'Sleep', CONCAT(p.TIME,'  second '), 0)  The idle time of the blocking party transaction 
FROM
information_schema.INNODB_LOCK_WAITS w
INNER JOIN information_schema.INNODB_TRX b ON b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.INNODB_TRX r ON r.trx_id = w.requesting_trx_id
INNER JOIN information_schema.INNODB_LOCKS l ON w.blocking_lock_id = l.lock_id AND l.`lock_trx_id`=b.`trx_id`
INNER JOIN information_schema.INNODB_LOCKS m ON m.`lock_id`=w.`requested_lock_id` AND m.`lock_trx_id`=r.`trx_id`
INNER JOIN information_schema. PROCESSLIST p ON p.ID = b.trx_mysql_thread_id
INNER JOIN information_schema. PROCESSLIST p2 ON p2.ID = r.trx_mysql_thread_id
ORDER BY
 Waiting time  DESC;

-------------------------------------------------------------------
View Code

Check the transaction waiting status

select
r.trx_id waiting_trx_id,
r.trx_mysql_thread_id waiting_thread,
r.trx_query waiting_query,
b.trx_id blocking_trx_id,
b.trx_mysql_thread_id blocking_thread,
b.trx_query blocking_query
from
information_schema.innodb_lock_waits w
inner join information_schema.innodb_trx b on b.trx_id = w.blocking_trx_id
inner join information_schema.innodb_trx r on r.trx_id = w.requesting_trx_id;
View Code

View more specific transaction waiting status

select
b.trx_state,
e.state,
e.time,
d.state as block_state,
d.time as block_time,
a.requesting_trx_id,
a.requested_lock_id,
b.trx_query,
b.trx_mysql_thread_id,
a.blocking_trx_id,
a.blocking_lock_id,
c.trx_query as block_trx_query,
c.trx_mysql_thread_id as block_trx_mysql_tread_id
from
information_schema.innodb_lock_waits a
left join information_schema.innodb_trx b on a.requesting_trx_id = b.trx_id
left join information_schema.innodb_trx c on a.blocking_trx_id = c.trx_id
left join information_schema.processlist d on c.trx_mysql_thread_id = d.id
left join information_schema.processlist e on b.trx_mysql_thread_id = e.id
order by
a.requesting_trx_id;
View Code

View unclosed transactions

–mysql 5.6

select
a.trx_id,
a.trx_state,
a.trx_started,
a.trx_query,
b.id,
b.user,
b.db,
b.command,
b.time,
b.state,
b.info,
c.processlist_user,
c.processlist_host,
c.processlist_db,
d.sql_text
from
information_schema.innodb_trx a
left join information_schema.processlist b on a.trx_mysql_thread_id = b.id
and b.command = 'sleep'
left join performance_schema.threads c on b.id = c.processlist_id
left join performance_schema.events_statements_current d on d.thread_id = c.thread_id;
–mysql 5.5

select
a.trx_id,
a.trx_state,
a.trx_started,
a.trx_query,
b.id,
b. user,
b. host,
b.db,
b.command,
b.time,
b.state,
b.info
from
information_schema.innodb_trx a
left join information_schema.processlist b on a.trx_mysql_thread_id = b.id
where
b.command = 'sleep';
View Code

View transactions that have not been closed for some time

select
trx_id,
trx_started,
trx_mysql_thread_id
from
information_schema.innodb_trx
where
trx_started < date_sub(now(), interval 1 minute)
and trx_operation_state is null
and trx_query is null;

mysql Query in progress sql

select * from information_schema.`PROCESSLIST` where info is not null ORDER BY time desc;

mysql Query slow log file location

show variables like "%slow_query_log%";

Look for fragmented tables

 Method 1 :
select table_schema db, table_name, data_free, engine
from information_schema.tables
where table_schema not in ('information_schema', 'mysql') and data_free > 0;

 Method 2 :
SELECT TABLE_NAME,(DATA_LENGTH+INDEX_LENGTH)/1024/1024 size_mb,data_free/1024/1024 free_mb,TABLE_ROWS
FROM information_schema.tables where table_schema not in ('information_schema', 'mysql')
and data_free/1024/1024>=1 order by free_mb desc;
View Code

Clean up table fragments

 Method 1 
alter table Table name engine=InnoDB alter table tableName engine=InnoDB; # Method 2
optimize table Table name optimize table tableName;

Find the table without primary key

Select t.table_schema,t.table_name,t.engine,t.table_rows
From information_schema.tables as t
Left join information_schema.table_constraints as tc
On tc.table_schema=t.table_schema
And tc.table_name=t.table_name
And tc.constraint_type='PRIMARY KEY'
Where t.table_type='BASE TABLE'
And tc.constraint_type is null
And t.table_schema not in ('mysql','performance_schema','information_schema');
View Code

Slow log related settings

more /etc/my.cnf
show variables like '%slow%';
show variables like '%long%';
set global slow_query_log=off;
set global slow_query_log=on;
set @@long_query_time=10;

 

5、 ... and 、ORACLE

oralce monitor

 Check the listening status 
lsnrctl status
 Start listening 
lsnrctl start
 lsnrctl stop 
lsnrctl stop
Register monitoring manually
alter system register;

oracle Password expiration processing

 Query the default password saving time :
 SELECT * FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';
 Change to indefinite , If you need to change your password regularly , You can set the number of days required for each password change cycle ( Such as :30:, Indicates every pass 30 You need to reset your password every day )
 No deadline :
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; 30 The password is valid for days :
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME
30;
 Switch to PDB perform :
alter session set container=orcl1;
 Change Password : 
alter user Password expired USERNAME identified by password ;

Archive log related

 Delete the file before the specified time 
find ./ -name *.log -mtime +7| xargs rm -rf
crosscheck archivelog all;
 Delete expired logs 
delete noprompt expired archivelog all;
 Delete all logs 
DELETE EXPIRED archivelog all;
 Delete the log three days ago 
delete archivelog until time 'sysdate -3';

Availability status

select INSTANCE_NUMBER,INSTANCE_NAME,STARTUP_TIME,STATUS from gv$instance;

Table space utilization status

SELECT d.tablespace_name "Name", d.status "Status",
TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), '99,999,990.90') "Size (M)",
TO_CHAR (NVL (a.BYTES - NVL (f.BYTES, 0), 0) / 1024 / 1024,
'99999999.99'
) USE,
TO_CHAR (NVL ((a.BYTES - NVL (f.BYTES, 0)) / a.BYTES * 100, 0),
'990.00'
) "Used %"
FROM SYS.dba_tablespaces d,
(SELECT tablespace_name, SUM (BYTES) BYTES
FROM dba_data_files
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM (BYTES) BYTES
FROM dba_free_space
GROUP BY tablespace_name) f
WHERE d.tablespace_name = a.tablespace_name(+)
AND d.tablespace_name = f.tablespace_name(+)
AND NOT (d.extent_management LIKE 'LOCAL' AND d.CONTENTS LIKE 'TEMPORARY')
UNION ALL
SELECT d.tablespace_name "Name", d.status "Status",
TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), '99,999,990.90') "Size (M)",
TO_CHAR (NVL (t.BYTES, 0) / 1024 / 1024, '99999999.99') USE,
TO_CHAR (NVL (t.BYTES / a.BYTES * 100, 0), '990.00') "Used %"
FROM SYS.dba_tablespaces d,
(SELECT tablespace_name, SUM (BYTES) BYTES
FROM dba_temp_files
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM (bytes_cached) BYTES
FROM v$temp_extent_pool
GROUP BY tablespace_name) t
WHERE d.tablespace_name = a.tablespace_name(+)
AND d.tablespace_name = t.tablespace_name(+)
AND d.extent_management LIKE 'LOCAL'
AND d.CONTENTS LIKE 'TEMPORARY';
View Code
Copy

Buffer hit rate

select(1-(sum(decode(name,'physical reads',value,0))/(sum(decode(name,'db block gets',value,0))
+sum(decode(name,'consistent gets',value,0)))))*100"Hit Ratio"
from gv$sysstat;

Data dictionary cache hit rate

select(1-(sum(getmisses)/sum(gets)))*100"Hit Ratio"from gv$rowcache;

Library cache hit rate

selectSum(Pins)/(Sum(Pins)+Sum(Reloads))*100"Hit Ratio"from gV$LibraryCache;

PGA Memory sort hit rate

select a.INST_ID,a.NAME,a.value "Disk Sorts", b.value "Memory Sorts",round((100*b.value)/decode((a.value+b.value),0,1,(a.value+b.value)),2)"Pct Memory Sorts"from gv$sysstat a, gv$sysstat b where a.name ='sorts (disk)'and b.name ='sorts (memory)';

 remarks : These values are in 98%  The above is better 

Data fragment status

USED_MB: Indicates that the object has used size 
FRAG_MB: Indicates the size of the fragment 
FRAGMENT_PER: Indicates the percentage of fragmentation 

alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
/*set lines 220 pages 300
col owner for a30
col TABLE_NAME for a50
col SEGMENT_TYPE for a20*/
SELECT /*+ parallel(b 4)*/ OWNER,
TABLE_NAME,
tablespace_name,
SEGMENT_TYPE,
segment_space_management MANAGEMENT,
TABLE_MB USED_MB,
ROUND(WASTE_PER * TABLE_MB /100,2) FRAG_MB,
WASTE_PER fragment_per,
LAST_ANALYZED
FROM (SELECT OWNER,
SEGMENT_NAME TABLE_NAME,
LAST_ANALYZED,
SEGMENT_TYPE,
GREATEST(ROUND(100*(NVL(HWM - AVG_USED_BLOCKS,0)/ GREATEST(NVL(HWM,1),1)),2),0) WASTE_PER,
ROUND(BYTES / POWER(1024,2),2) TABLE_MB,
NUM_ROWS,
BLOCKS,
EMPTY_BLOCKS,
HWM HIGHWATER_MARK,
AVG_USED_BLOCKS,
CHAIN_PER,
EXTENTS,
MAX_EXTENTS,
ALLO_EXTENT_PER,
DECODE(GREATEST(MAX_FREE_SPACE - NEXT_EXTENT,0),0,'N','Y') CAN_EXTEND_SPACE,
NEXT_EXTENT,
MAX_FREE_SPACE,
O_TABLESPACE_NAME TABLESPACE_NAME,
block_size,
segment_space_management
FROM (SELECT A.OWNER OWNER,
A.SEGMENT_NAME,
A.SEGMENT_TYPE,
A.BYTES,
B.NUM_ROWS,
A.BLOCKS BLOCKS,
B.EMPTY_BLOCKS EMPTY_BLOCKS,
A.BLOCKS - B.EMPTY_BLOCKS -1 HWM,
DECODE(ROUND((B.AVG_ROW_LEN * NUM_ROWS *(1+(PCT_FREE /100)))/ dt.block_size,0),0,1,
ROUND((B.AVG_ROW_LEN * NUM_ROWS *(1+(PCT_FREE /100)))/ dt.block_size,0))+2 AVG_USED_BLOCKS,
ROUND(100*(NVL(B.CHAIN_CNT,0)/ GREATEST(NVL(B.NUM_ROWS,1),1)),
2) CHAIN_PER,
ROUND(100*(A.EXTENTS / A.MAX_EXTENTS),2) ALLO_EXTENT_PER,
A.EXTENTS EXTENTS,
A.MAX_EXTENTS MAX_EXTENTS,
B.NEXT_EXTENT NEXT_EXTENT,
B.TABLESPACE_NAME O_TABLESPACE_NAME,
B.LAST_ANALYZED,
dt.block_size,
DT.segment_space_management
FROM SYS.DBA_SEGMENTS A,
SYS.DBA_TABLES B,
dba_tablespaces dt
WHERE A.OWNER = B.OWNER
and SEGMENT_NAME = TABLE_NAME
and dt.segment_space_management ='AUTO'
and B.tablespace_name in('TS_RPT_DATA','IX_RPT_DATA','PERFSTAT')
and dt.tablespace_name = a.tablespace_name
and b.last_analyzed > to_date('20210501','yyyymmdd')
union all
SELECT A.OWNER OWNER,
SEGMENT_NAME ||'.'|| B.PARTITION_NAME,
SEGMENT_TYPE,
BYTES,
B.NUM_ROWS,
A.BLOCKS BLOCKS,
B.EMPTY_BLOCKS EMPTY_BLOCKS,
A.BLOCKS - B.EMPTY_BLOCKS -1 HWM,
DECODE(ROUND((B.AVG_ROW_LEN * B.NUM_ROWS *(1+(B.PCT_FREE /100)))/ dt.block_size,0),0,1,
ROUND((B.AVG_ROW_LEN * B.NUM_ROWS *(1+(B.PCT_FREE /100)))/ dt.block_size,0))+2 AVG_USED_BLOCKS,
ROUND(100*(NVL(B.CHAIN_CNT,0)/ GREATEST(NVL(B.NUM_ROWS,1),1)),2) CHAIN_PER,
ROUND(100*(A.EXTENTS / A.MAX_EXTENTS),2) ALLO_EXTENT_PER,
A.EXTENTS EXTENTS,
A.MAX_EXTENTS MAX_EXTENTS,
B.NEXT_EXTENT,
B.TABLESPACE_NAME O_TABLESPACE_NAME,
d.last_analyzed,
dt.block_size,
DT.segment_space_management
FROM SYS.DBA_SEGMENTS A,
SYS.DBA_TAB_PARTITIONS B,
SYS.DBA_TABLES D,
dba_tablespaces dt
WHERE A.OWNER = B.TABLE_OWNER
and SEGMENT_NAME = B.TABLE_NAME
and SEGMENT_TYPE ='TABLE PARTITION'
and dt.segment_space_management ='AUTO'
and B.tablespace_name in('TS_RPT_DATA','IX_RPT_DATA','PERFSTAT')
and dt.tablespace_name = a.tablespace_name
AND D.OWNER = B.TABLE_OWNER
AND D.TABLE_NAME = B.TABLE_NAME
AND A.PARTITION_NAME = B.PARTITION_NAME
AND D.last_analyzed > to_date('20210501','yyyymmdd')),
(SELECT TABLESPACE_NAME F_TABLESPACE_NAME,
MAX(BYTES) MAX_FREE_SPACE
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME)
WHERE F_TABLESPACE_NAME = O_TABLESPACE_NAME
AND GREATEST(ROUND(100*(NVL(HWM - AVG_USED_BLOCKS,0)/GREATEST(NVL(HWM,1),1)),2),0)>12
AND OWNER notin('SYS','SYSMAN')
AND BLOCKS > POWER(1024,2)/ block_size) b
where ROUND(WASTE_PER * TABLE_MB /100,2)>100
ORDER BY 7 DESC;
View Code

Database process and deadlock process status

SELECT distinct SESS.SID,

SESS.SERIAL#,

LO.ORACLE_USERNAME,

LO.OS_USER_NAME,

AO.OBJECT_NAME,

LO.LOCKED_MODE,

'ALTER SYSTEM KILL SESSION '''|| SESS.SID ||','|| SESS.SERIAL# || ''' immediate;',

SESS.STATUS

FROM GV$LOCKED_OBJECT LO,

DBA_OBJECTS AO,

GV$SESSION SESS,

Gv$process p

WHERE AO.OBJECT_ID = LO.OBJECT_ID

AND LO.SESSION_ID = SESS.SID

and SESS.paddr = p.addr;
View Code

Oralce See check for configuration parameters

/*set linesize 200
col name format a40
col value format a40
set pagesize 2000*/
select name,value from v$parameter where isdefault='FALSE' order by 1;

  6、 ... and 、 HTTP Details of status code

2XX success

· 200 OK, Indicates that the request from the client is processed correctly on the server side · 204 No content, Indicates that the request was successful , But the response message does not contain the main body of the entity · 206 Partial Content, Make a range request

3XX Redirect

· 301 moved permanently, Permanent redirection , Indicates that the resource has been assigned a new URL · 302 found, Temporary redirections , Indicates that the resource has been temporarily assigned a new URL · 303 see other, Indicates that there is another URL, You should use GET Methods clove resources · 304 not modified, Indicates that the server allows access to resources , But due to the occurrence of the request not meeting the conditions · 307 temporary redirect, Temporary redirection , and 302 The meaning is the same

4XX Client error

· 400 bad request, Syntax error in request message · 401 unauthorized, Indicates that the request sent needs to be passed HTTP Authentication information for authentication · 403 forbidden, Indicates that access to the requested resource is denied by the server · 404 not found, Indicates that the requested resource was not found on the server

5XX Server error

· 500 internal sever error, Indicates that an error occurred on the server side while executing the request · 503 service unavailable, Indicates that the server is temporarily overloaded or under maintenance , Unable to process request

403 Detailed explanation

 On the whole , return 403 The status code is , Deny or prohibit access to . however , Although the server denies or prohibits access , But it has understood your request . The specific reasons are as follows :

 Error code :403.1
HTTP
403.1
 Blocking access : Disable executable access 
Internet
 information service 
 The reason is that the execution authority is not enough , The solution is :
 open “ Management tools ” Of “Internet
 information service ”, The right choice “WEB Site properties ” Of “ Home directory ” tab , hold “ Executive license ” Options from “ nothing ” Change it to “ Pure script ” Just fine .

 Error code :403.2
403.2 The error is due to " Read " Access is prohibited . This error is caused by no default web page available and directory browsing is not enabled for the directory , Or to display 
HTML
 The directory where the web page resides is only marked " Executable " or " Script " jurisdiction .

 Error code :403.3
403.3 The error is due to " write in " Access is prohibited , When trying to upload a file to a directory or modify a file in a directory , But this directory does not allow " Write " This error occurs when accessing .

 Error code :403.4
403.4 The error is due to the requirement SSL Caused by , You must use... In the address of the page you want to view "https".

 Error code :403.5
403.5 The error is due to the requirement to use 128 Bit encryption algorithm Web Caused by the browser , If your browser doesn't support 128 This error will occur in the bit encryption algorithm , You can connect to Microsoft website to upgrade your browser .

 Error code :403.6
403.6 The error is due to IP
 The address was rejected . If there are servers in the server that cannot access the site IP Address list , And you use IP When the address is in the list, you will return this error message .

 Error code :403.7
403.7 The error is because the customer certificate is required , When the resource to be accessed requires the browser to have a secure socket layer that the server can recognize 
(SSL) This error will be returned when the client certificate .

 Error code :403.8
403.8 The error is caused by disabling site access , If there is a server that cannot access the site DNS Name list , And you use 
DNS This information is returned when the name is in the list . Please pay attention to the difference 403.6 And 403.8 error .

 Error code :403.9
403.9 The error is caused by too many connected users , because Web The server is busy , This error is returned when there is too much traffic to process the request .

 Error code :403.10
403.10 The error is caused by an invalid configuration , When you try to execute... From a directory CGI、ISAPI Or other executable programs , But this error will be returned when the directory does not allow the program to be executed .

 Error code :403.11
403.11 The error is that you do not have permission to view the page due to a password change .

 Error code :403.12
403.12 The error is caused by the mapper denying access . The web page you want to view requires a valid customer certificate , And your customer certificate mapping does not have access to this Web The error that the mapper denies access will be returned when the site is accessed .

 Error code :403.13
403.13 The error is that the web page to be viewed requires a valid client certificate, and the client certificate used has been revoked , Or it is impossible to determine whether the certificate has been revoked .

 Error code :403.15
403.15 The error is caused by too many customer access permissions , This error is returned when the server exceeds its client access permission limit .

 Error code :403.16
403.16 The error is caused by the untrusted or invalid client certificate .

 Error code :403.17
403.17 The error is caused by the fact that the customer certificate has expired or is not yet valid .

 The following three are IIS6.0 special :
403.18- The requested cannot be performed in the current application pool URL.
403.19- Cannot execute for clients in this application pool CGI.
403.20-Passport Login failed 
View Code

 

 

 

 
 
 
 
原网站

版权声明
本文为[Scenery Xiaolei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/184/202207032046183494.html