oracle建立表空間 使用者

2021-08-31 01:46:09 字數 3651 閱讀 8656

oracle建立表空間.使用者:

--檢視表空間

sql**

1.select c.tablespace_name tablespace_name, round(a.bytes/1048576,2) total_size,round((a.bytes-b.bytes)/1048576,2) used_size,

2.round(b.bytes/1048576,2) free_size,

3.round(b.bytes/a.bytes * 100,2)||'%' free_pct from

4.(select tablespace_name,sum(a.bytes) bytes

5.from sys.dba_data_files a

6.group by tablespace_name) a,

7.(select a.tablespace_name,

8.nvl(sum(b.bytes),0) bytes

9.from sys.dba_data_files a,

10.sys.dba_free_space b

11.where a.tablespace_name = b.tablespace_name (+)

12.and a.file_id = b.file_id (+)

13.group by a.tablespace_name) b,

14.sys.dba_tablespaces c

15.where a.tablespace_name = b.tablespace_name(+)

16.and a.tablespace_name = c.tablespace_name

17.order by round(b.bytes/1048576,2);

select c.tablespace_name tablespace_name, round(a.bytes/1048576,2) total_size,round((a.bytes-b.bytes)/1048576,2) used_size,

round(b.bytes/1048576,2) free_size,

round(b.bytes/a.bytes * 100,2)||'%' free_pct from

(select tablespace_name,sum(a.bytes) bytes

from sys.dba_data_files a

group by tablespace_name) a,

(select a.tablespace_name,

nvl(sum(b.bytes),0) bytes

from sys.dba_data_files a,

sys.dba_free_space b

where a.tablespace_name = b.tablespace_name (+)

and a.file_id = b.file_id (+)

group by a.tablespace_name) b,

sys.dba_tablespaces c

where a.tablespace_name = b.tablespace_name(+)

and a.tablespace_name = c.tablespace_name

order by round(b.bytes/1048576,2);

--新建臨時表空間

sql**

1.create temporary tablespace test_temp tempfile 'd:\oracle10g\product\10.2.0\oradata\orcl\test_temp1.dbf'

2.size 128m

3.autoextend on

4.next 32m maxsize 2048m

5.extent management local;

create temporary tablespace test_temp tempfile 'd:\oracle10g\product\10.2.0\oradata\orcl\test_temp1.dbf'

size 128m

autoextend on

next 32m maxsize 2048m

extent management local;

--建立資料表空間

sql**

1.create tablespace test_data

2.logging

3.datafile 'd:\oracle10g\product\10.2.0\oradata\orcl\test_data1.dbf'

4.size 128m

5.autoextend on

6.next 32m maxsize 5120m

7.extent management local;

create tablespace test_data

logging

datafile 'd:\oracle10g\product\10.2.0\oradata\orcl\test_data1.dbf'

size 128m

autoextend on

next 32m maxsize 5120m

extent management local;

--建立undo空間

sql**

1.create undo tablespace undo_small

2.datafile 'd:\oracle10g\product\10.2.0\oradata\orcl\undotbs02.dbf'

3.size 2m

4.autoextend off;

5.--

6.create undo tablespace undotbs1 datafile'g:\clipshe\clipshe\undotbs01.dbf' size 512m autoextend on next 5m maxsize unlimited;

create undo tablespace undo_small

datafile 'd:\oracle10g\product\10.2.0\oradata\orcl\undotbs02.dbf'

size 2m

autoextend off;

--create undo tablespace undotbs1 datafile'g:\clipshe\clipshe\undotbs01.dbf' size 512m autoextend on next 5m maxsize unlimited;

--建立使用者並指定表空間

sql**

1.create user test identified by test

2.default tablespace test_data

3.temporary tablespace test_temp;

create user test identified by test

default tablespace test_data

temporary tablespace test_temp;

--授權

sql**

1.grant connect,resource to test;

oracle建立表空間,建立使用者

建立臨時表空間 create temporary tablespace test temp tempfile e oracle product 10.2.0 oradata testserver test temp01.dbf size 32m autoextend on next 32m maxs...

oracle建立表空間,建立使用者

建立臨時表空間 create temporary tablespace test temp tempfile e oracle product 10.2.0 oradata testserver test temp01.dbf size 32m autoextend onnext 32m maxsi...

oracle建立表空間,建立使用者

建立臨時表空間 create temporary tablespace test temp tempfile e oracle product 10.2.0 oradata testserver test temp01.dbf size 32m autoextend on next 32m maxs...