SELECT OWNER, OBJECT_NAME, OBJECT_TYPE, CREATED, LAST_DDL_TIME, TIMESTAMP, STATUS
FROM DBA_OBJECTS WHERE OWNER=UPPER('SCOTT')
SELECT OWNER, TABLE_NAME, TABLESPACE_NAME FROM DBA_TABLES
SELECT OWNER, TABLE_NAME, TABLESPACE_NAME FROM ALL_TABLES
SELECT TABLE_NAME, TABLESPACE_NAME FROM USER_TABLES
SELECT T.*,I.INDEX_TYPE FROM USER_IND_COLUMNS T, USER_INDEXES I WHERE
T.INDEX_NAME= I.INDEX_NAME AND T.TABLE_NAME = I.TABLE_NAME
AND T.TABLE_NAME = '要查询的表'
SELECT CU.* FROM USER_CONS_COLUMNSCU, USER_CONSTRAINTS AU
WHERE CU.CONSTRAINT_NAME = AU.CONSTRAINT_NAME
AND AU.CONSTRAINT_TYPE = UPPER('P') AND AU.TABLE_NAME = '要查询的表'
SELECT COLUMN_NAME FROM USER_CONS_COLUMNSCU, USER_CONSTRAINTS AU
WHERE CU.CONSTRAINT_NAME = AU.CONSTRAINT_NAME AND AU.CONSTRAINT_TYPE = UPPER('U')
AND AU.TABLE_NAME = '要查询的表'
SELECT * FROM USER_CONSTRAINTS C WHERE C.CONSTRAINT_TYPE = 'R' AND C.TABLE_NAME = '要查询的表'
SELECT * FROM USER_CONS_COLUMNSCL WHERE CL.CONSTRAINT_NAME = '外键名称'
SELECT * FROM USER_CONS_COLUMNSCL WHERE CL.CONSTRAINT_NAME = '外键引用表的键名'
SELECT T.*,C.COMMENTS FROM USER_TAB_COLUMNS T, USER_COL_COMMENTS C
WHERE T.TABLE_NAME = C.TABLE_NAME AND T.COLUMN_NAME = C.COLUMN_NAME AND T.TABLE_NAME = '要查询的表'
SELECT TABLESPACE_NAME FROM DBA_DATA_FILES GROUP BY TABLESPACE_NAME
SQL>SHOW PARAMETER PROCESSES
NAME TYPE VALUE
----------------------------------------------- ------------------------------
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 150
SQL>ALTER SYSTEM SET PROCESSES=VALUE SCOPE=SPFILE
–重启数据库
SQL>SHUTDOWN ABORT
SQL>START FORCE
SQL>SELECT * FROM V$SESSION WHERE USERNAME IS NOT NULL;
SQL>SELECT USERNAME,COUNT(USERNAME) FROM V$SESSION WHERE USERNAME IS NOT NULL GROUPBY USERNAME;
#查看指定用户的连接数
SQL>SELECT COUNT(*) FROM V$SESSION WHERE STATUS='ACTIVE';
#查看并发连接数
SQL>SELECT COUNT(*) FROM V$SESSION WHERE PROGRAM='JDBC THIN CLIENT';
#查看jdbc连接oracle的数目
SQL>SELECT * FROM V$INSTANCE;
SQL>SHOW PARAMETER INSTANCE_NAME;
SQL>SHOW PARAMETER DB_NAME;
SQL>SHOW PARAMETER DB_DOMAIN;
SQL>SHOW PARAMETER SERVICE_NAMES;
SQL>SHOW PARAMETER GLOBAL;
SELECT DBF.TABLESPACE_NAME,
DBF.TOTALSPACE "总量(M)",
DBF.TOTALBLOCKS AS "总块数",
DFS.FREESPACE "剩余总量(M)",
DFS.FREEBLOCKS "剩余块数",
(DFS.FREESPACE / DBF.TOTALSPACE) * 100 AS "空闲比例"
FROM (SELECT T.TABLESPACE_NAME,
SUM(T.BYTES) / 1024 / 1024 TOTALSPACE,
SUM(T.BLOCKS) TOTALBLOCKS
FROM DBA_DATA_FILES T
GROUP BY T.TABLESPACE_NAME) DBF,
(SELECT TT.TABLESPACE_NAME,
SUM(TT.BYTES) / 1024 / 1024 FREESPACE,
SUM(TT.BLOCKS) FREEBLOCKS
FROM DBA_FREE_SPACE TT
GROUP BY TT.TABLESPACE_NAME) DFS
WHERE TRIM(DBF.TABLESPACE_NAME) = TRIM(DFS.TABLESPACE_NAME)
SELECT T.NAME"TABLESPACE NAME",
FREE_SPACE,
(TOTAL_SPACE - FREE_SPACE) USED_SPACE,
TOTAL_SPACE
FROM (SELECT TABLESPACE_NAME, SUM(BYTES / 1024 / 1024) FREE_SPACE
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) FREE,
(SELECT B.NAME, SUM(BYTES / 1024 / 1024) TOTAL_SPACE
FROM SYS.V_$DATAFILE A, SYS.V_$TABLESPACE B
WHERE A.TS# = B.TS#
GROUP BY B.NAME) T
WHERE FREE.TABLESPACE_NAME = T.NAME