資料表空間(上),資料表空間(
4.直接修改資料表空間擴容:
(1)一般資料表空間:
自動擴充: alter database datafile '/oracle/app/oradata/tbs_sys_ptcl.dbf' autoextend on;
關閉自動擴充:alter database datafile '/oracle/app/oradata/tbs_sys_ptcl.dbf' autoextend off;
指定大小: alter database datafile '/oracle/app/oradata/tbs_sys_ptcl.dbf' resize 50m;
(2)暫存資料表空間
自動擴充: alter database tempfile '/oracle/app/oradata/tbs_temp_ptcl.dbf' autoextend on;
關閉自動擴充:alter database datafile '/oracle/app/oradata/tbs_sys_ptcl.dbf' autoextend off;
指定大小: alter database tempfile '/oracle/app/oradata/tbs_temp_ptcl.dbf' resize 50m;
(3)擴容後尋找語句:
select * from dba_tablespaces a where a.tablespace_name like '%PTCL';
5.為資料表空間添加新的資料檔案
(1)一般資料表空間:
指定大小: alter tablespace tbs_sys_ptcl add datafile '/oracle/oradata/ora242/YM_tbs/tbs_sys_ptcl.ora' size 50M ;
自動擴充 alter tablespace tbs_sys_ptcl add datafile '/oracle/oradata/ora242/YM_tbs/tbs_sys_ptcl.ora' size 50M
autoextend on;
(2)暫存資料表空間
指定大小:alter tablespace tbs_temp_ptcl add tempfile '/oracle/oradata/ora242/YM_tbs/tbs_temp_ptcl.dbf' size 50M;
自動擴充:alter tablespace tbs_temp_ptcl add tempfile '/oracle/oradata/ora242/YM_tbs/tbs_temp_ptcl.dbf' size 50M
autoextend on;
6. 刪出使用者及其資料表空間:
(1)刪掉使用者:
drop user lbi_sys_ptcl cascade;
(2)刪掉資料表空間:
drop tablespace TBS_SYS_PTCL including contents and datafiles CASCADE CONSTRAINTS ;
(3)刪掉資料檔案:
alter database datafile '/oracle/oradata/ora242/YM_tbs/TBS_DW_YM.ora' offline drop;
怎在Oracle中建立表與資料表空間?
1、用sys使用者登入,先建立資料表空間,再建立使用者,使用者要建在資料表空間上;
例:CREATE TABLESPACE "CC_HINDEX"
---- DATAFILE 'F:\oracle\product\10.2.0\oradata\資料庫名\CC_HINDEX.ora' SIZE 300M
AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED
ONLINE
PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;
-----create user XXX
identified by XXX
quota unlimited on cc_hindex
-- Grant/Revoke role privileges
grant connect to xxx;
grant resource to xxx;
grant dba to xxx;
-- Grant/Revoke system privileges
grant alter session to xxx;
希望對你的協助,以前我走過這樣的誤區。
在oracle資料庫,怎查看建在某個資料表空間上面個的所有表名?
select table_name ,tablespace_name from dba_tables where tablespace_name = '資料表空間名';
需要DBA許可權
select table_name ,tablespace_name from user_tables where tablespace_name = '資料表空間名';
只查目前使用者的不需DBA許可權