create user dev identified by iampaawd;
grant connect, resource to dev;
select * from user_tables;
select * from user_tab_comments;
select * from user_col_comments;
『%select distinct%』 為你要找的sql,'3039j4pnpw0sf』是你找到的sql_id
select sql_id, sql_text from v$sql where sql_text like '%select distinct%';
select * from v$sql_plan where sql_id='3039j4pnpw0sf';
select * from table(dbms_xplan.display_cursor('3039j4pnpw0sf',0));
select * from table( dbms_xplan.display_cursor('3039j4pnpw0sf'));
select sequence_name, min_value, max_value, increment_by, last_number from user_sequences;
select sql_text, last_load_time,sql_id from v$sql where last_load_time is not null and sql_text like 'select%' order by last_load_time desc;
select name,datatype_string,value_string from v$sql_bind_capture where sql_id='0bgqvw16fpts0';
select count(*) from v$process;
select * from v$parameter where name = 'processes';
alter system set processes=1500 scope=spfile;
shutdown immediate;
startup;
select userenv('language') from dual;
select * from nls_database_parameters where parameter like '%characterset%';
select * from nls_instance_parameters;
su oracle
sqlplus /nolog
conn /as sysdba
alter database set time_zone='+8:00';
shutdown immediate;
startup mount
alter system enable restricted session;
alter system set job_queue_processes=0;
alter system set aq_tm_processes=0;
alter database open;
alter database character set internal_use zhs16gbk;
alter database national character set internal_use al16utf16;
select * from v$nls_parameters;
shutdown immediate;
startup
exit
exit
chmod 700 /home
su oracle
sqlplus /nolog
conn /as sysdba
create tablespace tbs_hisuser datafile '/home/tablespace01' size 100m autoextend on;
exit
exit
select t1.table_name as "表名稱",
t3.comments as "表說明",
t1.column_name as "欄位名稱",
t1.data_type as "資料型別",
t1.data_length as "長度",
t1.nullable as "是否為空",
t2.comments as "字段說明",
t1.data_default "預設值"
from cols t1 left join user_col_comments t2
on t1.table_name=t2.table_name and t1.column_name=t2.column_name
left join user_tab_comments t3
on t1.table_name=t3.table_name
where not exists ( select t4.object_name from user_objects t4
where t4.object_type='table'
and t4.temporary='y'
and t4.object_name=t1.table_name )
order by t1.table_name, t1.column_id;
--查詢鎖表
select b.owner, b.object_name, a.session_id, a.locked_mode
from v$locked_object a, dba_objects b
where b.object_id = a.object_id;
--查詢導致鎖表的session
select b.username, b.sid, b.serial#, logon_time
from v$locked_object a, v$session b
where a.session_id = b.sid
order by b.logon_time;
--kill session
alter system kill session 'sid,serial#';
本文所有sql,均為網路蒐集。 oracle 常用語句
oracle 產看表空間 select total.name tablespace name free space,total space free space used space,total space from select tablespace name,sum bytes 1024 102...
oracle常用語句
drop tablespace crm online space including contents and datafiles 刪除表空間 drop user wuliu01 cascade 刪除使用者 exp orcl file d dmp 匯出資料庫 imp orcl file e alen...
oracle 常用語句
oracle 常用語句 查詢表的大小 select t.owner,t.segment name,sum t.blocks 8 1024 m as s,t.segment type from dba segments t where t.owner user name group by t.owne...