Database Common Commands

Source: Internet
Author: User

Process ViewSelectCount(*) fromv$process;Command window: show parameter process;to modify the maximum number of connections allowed for a database:alter system SET processes = + scope = SPFile;  Permissions ViewSELECT * from dba_role_privs where grantee = ' SYS '; Session ViewSelect * from v$sessionShow Parameter SessionsAlter systemKillSession' 4276,1329 ';Query and kill session in a RAC environmentSelect * fromgv$sessionwhereusername=' Crm_base 'Altersystem KillSession' 4276,1329,@2 ' ; Table name ViewSelect* fromTabSelect* fromAll_tableswhereowner=' crm_so '-userSelect* fromDba_table--DBASelecttable_name from(Select * fromUser_tables)Order bytable_nameASC; User ViewSELECT * from Dba_users 
 view table spaces using physical file names, size, used space, utilizationSelectb.file_name Physical file name,b.tablespace_name table Space,b.bytes/1024/1024 size M,(B.bytes-sum (NVL (a.bytes,0)))/1024/1024 has used M,substr ((B.bytes-sum (NVL (a.bytes,0))/(b.bytes) *100,1,5) UtilizationFrom dba_free_space a,dba_data_files bwhere a.file_id=b.file_idGROUP BY B.tablespace_name,b.file_name,b.bytesorder by B.tablespace_name; extended tablespace File sizeALTER DATABASE datafile '/HOME/ORACLE/11G/DBS/NTONSITE/DATA_CS.DBF ' Resize 1000m; Set table space to auto-expand Add a tablespace filealter tablespace data_base Add datafile ' +dg_tcrm_data/crm/data_base3.dbf ' size 10m reuse autoextend on next 100m maxs ize 10g;  Deleting a tablespace filealter tablespace data_base Drop datafile ' +dg_tcrm_data/crm/data_so3.dbf '; to view a table space's create statementSELECT Dbms_metadata. GET_DDL (' tablespace ', ts.tablespace_name)From dba_tablespaces TS;  Use the Toad tool to view tables, users, table spaces, etc. create statements   Lock Table HandlingSELECT a.object_id,B.object_name,a.session_id,A.oracle_username,A.os_user_name,a.process,A.locked_mode,C.machine,C.module,C.action,D.sql_textFrom v$locked_object A, dba_objects b,v$session c,v$sql DWHERE a.object_id = b.object_id and a.session_id = c.sid and c.sql_address = d.address;  SELECT T2. USERNAME, T2. SID, T2. serial#, T2. Logon_timeFrom v$locked_object T1, v$session T2WHERE T1. session_id = T2. SIDORDER by T2. Logon_time; ALTER SYSTEM KILL SESSION ' 3172, 25456 '; Select p.*From v$session s,v$process pwhere s.paddr=p.addr and s.sid=3172       

Database Common Commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.