標籤:oracle 資料庫中 drop table 與purge 實際樣本: CREATE OR REPLACE PROCEDURE pro_droptable IS cursor cur is select table_name from user_tables where table_name like ‘TEMPTABLE%‘; drop_sql &
標籤:oracle 外鍵 1 串聯刪除Oracle在外鍵的刪除上有NO ACTION(類似RESTRICT)、CASCADE和SET NULL三種行為。下面以學生-班級為例說明不同情況下的外鍵刪除,學生屬於班級,班級的主鍵是學生的外鍵。-- 班級表CRATE TABLE TB_CLASS( ID NUMBER NOT NULL, --班級主鍵 NAME VARCHAR2(50), --班級名稱
標籤:一、遞迴查詢1、表機構 SQL> desc comm_org_subjection Name Null? Type ----------------------------------------- -------- ---------------------------- ORG_SUBJECTION_ID NOT NULL VARCHAR2(32
標籤:oracle效能最佳化create table t2 as select * from dba_objects; 建索引:create index idx_t2 on t2(object_id);2.收集T2的表所有列和表上所有索引的統計資訊:exec dbms_stats.gather_table_stats(ownname=>‘SYS‘,tabname=>‘T2‘,estimate_percent=>100,cascade=>true,degree=
標籤:在Oracle 11.2的資料庫中建表時遇到 RESULT_CACHE (MODE DEFAULT) ORA-00922: missing or invalid optionhostdr:[/home/oracle]$sqlplus / as sysdbaSQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 9 12:52:11 2015Copyright (c) 1982, 2011, Oracle. All rights
標籤:1、查詢資料庫中的資料表空間名稱1)查詢所有資料表空間select tablespace_name from dba_tablespaces; select tablespace_name from user_tablespaces; 2)查詢使用過的資料表空間 select distinct tablespace_name from dba_all_tables;select distinct tablespace_name from user_
標籤:1.一般過程create or replace procedure p1as begin dbms_output.put_line(‘Hello World‘); end; --調用 call p1();2.接收參數create or replace procedure p2(p_name varchar,p_age in int)as v_id int;begin select max(id) into v_id from
標籤:一、忘記除SYS、SYSTEM使用者之外的使用者的登入密碼。 用SYS (或SYSTEM)使用者登入: CONN SYS/PASS_WORD AS SYSDBA; 使用如下語句修改使用者的密碼: ALTER USER user_name IDENTIFIED BY "newpass"; 注意:密碼不能全是數字。並且不能是數字開頭。否則會出現:ORA-00988: