1、建立新的表空間;
2、建立使用者;
3、通過修改檔案大小與增加檔案的方式擴容表空間;
4、人為移動資料檔案,檢驗建立表的效果;
1、建立新的表空間;
sql> create tablespace test_data
2 logging
3 datafile '/opt/oracle/oradata/bisal/test_data_01.dbf'
4 size 10m
5 autoextend on
6 next 10m maxsize 2000m
7 extent management local;
tablespace created.
[oracle@liu bisal]$ ls -rlht
total 1.5g
-rw-r----- 1 oracle oinstall 11m sep 27 22:56 test_data_01.dbf
2、建立使用者;
sql> create user test_data identified by test_data
2 default tablespace test_data
3 temporary tablespace tempts1;
user created.
sql> select username from dba_users;
username
------------------------------
test_data
3、通過修改檔案大小與增加檔案的方式擴容表空間;
sql> alter database datafile '/opt/oracle/oradata/bisal/test_data_01.dbf' resize 25m;
database altered.
[oracle@liu bisal]$ ls -rlht
total 1.5g
-rw-r----- 1 oracle oinstall 26m sep 27 23:01 test_data_01.dbf
sql> alter tablespace test_data add datafile '/opt/oracle/oradata/bisal/test_data_02.dbf' size 3m;
tablespace altered.
[oracle@liu bisal]$ ls -rlht
total 1.5g
-rw-r----- 1 oracle oinstall 26m sep 27 23:01 test_data_01.dbf
-rw-r----- 1 oracle oinstall 3.1m sep 27 23:03 test_data_02.dbf
4、人為移動資料檔案,檢驗建立表的效果;
mv test_data_01.dbf ../.
mv test_data_02.dbf ../.
用該使用者登入之前需要賦予相關許可權:
create session許可權:
sp2-0157: unable to connect to oracle after 3 attempts, exiting sql*plus
create table許可權:
sql> create table test (x int);
create table test (x int)
*error at line 1:
ora-01031: insufficient privileges
sql> grant create table to test_data;
grant succeeded.
增加使用者在表空間的使用量限制:
sql> create table test (x int);
create table test (x int)
*error at line 1:
ora-01950: no privileges on tablespace 'test_data'
建立時錯誤:
sql> create table test(x int);
create table test(x int)
*error at line 1:
ora-01116: error in opening database file 7
ora-01110: data file 7: '/opt/oracle/oradata/bisal/test_data_02.dbf'
ora-27041: unable to open file
linux error: 2: no such file or directory
additional information: 3
sql> create table test(x int);
table created.
表空間,建立使用者,授權,表空間增加資料檔案
表空間 表空間 create tablespace ry ts datafile c ts ry.dbf size 3000m autoextend on next 100m 建立使用者 建立使用者 create user ry 使用者 identified by ry 密碼 default tab...
移動表空間資料檔案
2011年5月31日 移動表空間資料檔案方法 一 首先啟用介質恢復即開啟歸檔模式,用sys使用者 如果已經開啟則省略該步驟 sql shutdown immediate 資料庫已經關閉。已經解除安裝資料庫。oracle 例程已經關閉。sql startup mount oracle 例程已經啟動。t...
表空間和資料檔案
authot yeexun date 發表於 2010年12月26日 10 09 00 address jau 17 304 管理表空間和資料檔案 介紹表空間是資料庫的邏輯組成部分,從物理上講,資料庫資料存放在資料檔案中,從邏輯上講,資料庫則是存放在表空間中,表空間由乙個或是多個資料檔案組成。資料庫...