一组Linux命令
今天做测试发现Oracle服务器磁盘使用率达到100%导致Oracle Server 不能够正常运行,花了好久时间最后请教Linux高手清理了出了100GB的空间,下面列出用到的一些Linux Command, as Following:
1. Use 'df' to check file system disk usage
df -kdf -l
?the outputs:
Filesystem 1K-blocks Used Available Use% Mounted on/dev/mapper/VolGroup00-LogVol00 145787328 36632352 101629808 27% //dev/sda1 101086 17504 78363 19% /boottmpfs 1733140 916028 817112 53% /dev/shm
?
2. Use 'du' check?current folder disk usage and sort by size
du -sm * | sort -nr | more
?the outputs sample:
16856 u0114346 root3210 usr2455 home895 dev132 lib112 etc109 var100 opt40 sbin29 lib6412 boot9 bin1 tmp1 tftpboot1 srv1 mnt1 media1 lost+found0 sys
?
3. A very useful command for connect to oracle from root user:
su - oraclesqlplus / as sysdba;
?outputs:
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 29 20:55:15 2011Copyright (c) 1982, 2010, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options
?
4. Shutdown oracle instance:
shutdown immediate;
?outputs:
Database closed.Database dismounted.ORACLE instance shut down.
?
5. Exit from sqlplus and stop tns listener:
exittnslsnr stopps -ef|grep oracle
?outputs:
oracle 23955 1 0 20:27 ? 00:00:00 /u01/oracle/bin/tnslsnr LISTENER -inheritroot 24508 21559 0 20:54 pts/1 00:00:00 su - oracleoracle 24509 24508 0 20:54 pts/1 00:00:00 -bashroot 24569 24538 0 20:55 pts/1 00:00:00 su - oracleoracle 24570 24569 0 20:55 pts/1 00:00:00 -bashoracle 24635 24570 0 21:04 pts/1 00:00:00 ps -eforacle 24636 24570 0 21:04 pts/1 00:00:00 grep oracle
?
6. execute 'lsnrctl stop'
lsnrctl stop
?outputs:
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 29-SEP-2011 21:06:58Copyright (c) 1991, 2010, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))The command completed successfully
?
7. start tns listener:
lsnrctl start
?outputs:
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 29-SEP-2011 21:09:32Copyright (c) 1991, 2010, Oracle. All rights reserved.Starting /u01/oracle/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.2.0 - ProductionSystem parameter file is /u01/oracle/network/admin/listener.oraLog messages written to /u01/diag/tnslsnr/yinjidan-lt/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=yinjidan-lt.tibco-support.com)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.2.0 - ProductionStart Date 29-SEP-2011 21:09:32Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/oracle/network/admin/listener.oraListener Log File /u01/diag/tnslsnr/yinjidan-lt/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=yinjidan-lt.tibco-support.com)(PORT=1521)))The listener supports no servicesThe command completed successfully
?
8. start oracle instance
sqlplus / as sysdbastartup
outputs:
ORACLE instance started.Total System Global Area 1419685888 bytesFixed Size 2226472 bytesVariable Size 1073743576 bytesDatabase Buffers 335544320 bytesRedo Buffers 8171520 bytesDatabase mounted.Database opened.
??