Oracle調研常用DML

來源:互聯網
上載者:User
--查看oracle的執行個體名,所在主機名稱,版本select INSTANCE_NAME,HOST_NAME,VERSION from v$instance;--查看oracle版本的詳細資料,位元,其他組件資訊select * from v$version--查看資料庫伺服器字元集,來源props$select * from nls_database_parameters;select userenv('language') from dual;--查看用戶端字元集,來源v$parameterselect * from nls_instance_parameters--會話字元集select * from nls_session_parameters--查看資料庫名select name from v$database--查看資料庫中所用的資料表空間select tablespace_name from dba_tablespaces;--查看錶空間使用者分布的資訊select tablespace_name,owner,sum(bytes)/1024/1024 from dba_segments group by tablespace_name,owner;-- 查看錶空間未使用空間大小select tablespace_name,sum(bytes)/1024/1024 from dba_free_space group by tablespace_name; --查看所有資料表空間大小select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name; --查看所有使用者名稱,預設資料表空間和臨時空間 select username,default_tablespace,temporary_tablespace from dba_users;--查看所有啟用的使用者名稱,預設資料表空間和臨時空間select username,default_tablespace,temporary_tablespace from dba_users where account_status='OPEN';-- 獲得目前使用者所有表的DDL語句SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name) FROM USER_TABLES u;--查看目前使用者所有分區表的分區列資訊select * from user_part_key_columns;--查詢分區表名,擁有者(根據TEST使用者)select table_name,owner from all_part_tables where owner='TEST';--查看分區表的所用者,分區表名,表分區名,表分區所在的資料表空間(根據分區表名TEST2)select table_owner,table_name,partition_name,tablespace_name from all_tab_partitions where table_name ='TEST2';--查看使用者表中各欄位的資料類型(已指定TEST使用者下的TEST2表)select column_name,data_type from all_tab_cols where table_name='TEST2'and owner='TEST';--查詢表的索引select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name='TEST';--查詢表的主鍵select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' AND cu.table_name = 'TEST';--查看記錄模式select log_mode from v$database; -- 查看資料庫最小supplemental logging狀態select supplemental_log_data_min from v$database;--查看當前資料庫force logging的狀態select force_logging from v$database;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.