oracle使用技巧

2021-08-27 22:21:26 字數 1788 閱讀 7892

select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 or num_rows is null

查詢表數量

select    table_name   from    all_tables     where     owner='bdcbdc1'  order by table_name;

建立臨時表空間

create temporary tablespace user_temp

tempfile 'd:\oracle\oradata\oracle9i\user_temp.dbf'

size 50m

autoextend on

next 50m maxsize 20480m

extent management local;

建立表空間

create tablespace user_data

logging

datafile 'd:\oracle\oradata\oracle9i\user_data.dbf'

size 50m

autoextend on

next 50m maxsize 20480m

extent management local;

誤刪恢復

insert

into

emp

select

*--6分鐘前刪除的記錄

from

(select

*--6分鐘前刪除的記錄

from

empas

oftimestamp

sysdate-6/1440

--6分鐘前的原始資料

minus--減去

select

*from

emp--現在表中的記錄 )

-- user sql

create user test identified by test

default tablespace "bdc"

temporary tablespace "temp";

-- quotas

-- roles

grant "imp_full_database" to test ;

grant "connect" to test ;

grant "resource" to test ;

grant "exp_full_database" to test ;

alter user test default role "imp_full_database","connect","resource","exp_full_database";

-- system privileges

show parameter db_block_size ;

select (select max(block_id) from dba_extents where tablespace_name = 'bdc')*8192/1024/1024 from dual;

alter database datafile 'd:\soft\oracle\oradata\orcl\system01.dbf' resize 700m;

select dbms_metadata.get_ddl('tablespace', ts.tablespace_name)

from dba_tablespaces ts where ts.tablespace_name = 'bdc';

Oracle中Decode 函式使用技巧

decode 函式使用技巧 軟體環境 1 windows nt4.0 oracle 8.0.4 2 oracle安裝路徑為 c orant 含 釋 decode 條件,值1,翻譯值1,值2,翻譯值2,值n,翻譯值n,預設值 該函式的含義如下 if 條件 值1 then return 翻譯值1 els...

Oracle中Decode 函式使用技巧

decode 函式使用技巧 軟體環境 1 windows nt4.0 oracle 8.0.4 2 oracle安裝路徑為 c orant 含 釋 decode 條件,值1,翻譯值1,值2,翻譯值2,值n,翻譯值n,預設值 該函式的含義如下 if 條件 值1 then return 翻譯值1 els...

Oracle中Decode 函式使用技巧

decode函式是oracle pl sql是功能強大的函式之一,目前還只有oracle公司的sql提供了此函式,其他資料庫廠商的sql實現還沒有此功能。decode有什麼用途呢?先構造乙個例子,假設我們想給智星職員加工資,其標準是 工資在8000元以下的將加20 工資在8000元以上的加15 通常...