国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > Oracle > 正文

Oracle數(shù)據(jù)庫(kù)中管理表空間和數(shù)據(jù)文件

2024-08-29 13:52:30
字體:
供稿:網(wǎng)友
Oracle數(shù)據(jù)庫(kù)中管理表空間和數(shù)據(jù)文件

數(shù)據(jù)庫(kù)的三大組成部分:數(shù)據(jù)文件,控制文件,Redo日志。

表空間分為系統(tǒng)表空間和非系統(tǒng)表空間。

SYSTEM表空間是最基本的,必須的,Oracle建議你為用戶數(shù)據(jù),用戶索引,Undo數(shù)據(jù)段,臨時(shí)數(shù)據(jù)段創(chuàng)建單獨(dú)的表空間。

管理員可以對(duì)表空間執(zhí)行以下管理操作:

1.新建表空間,調(diào)整數(shù)據(jù)文件大小,添加數(shù)據(jù)文件到表空間。

2.設(shè)置和修改缺省的數(shù)據(jù)段存儲(chǔ)設(shè)置。

3.使表空間變?yōu)橹蛔x或讀寫狀態(tài)。

4.設(shè)置表空間為臨時(shí)或永久。

5.刪除表空間。

創(chuàng)建表空間的命令:

SQL> create tablespace userdat datafile '/home/oracle/oradata/userdat01.dbf' size 10m autoextend on next 1m maxsize 20m;

Tablespace created.

表空間中的extents可以由數(shù)據(jù)字典表或位圖進(jìn)行管理,創(chuàng)建表空間時(shí)可以選擇:

本地管理表空間:extent management local

字典管理表空間:extent management dictionary

Undo表空間:

僅用于存儲(chǔ)undo數(shù)據(jù)段,extent只能采用本地管理。

Temp表空間:

僅用于排序操作,不包含任何永久對(duì)象,extent推薦采用本地管理。

以下命令用于指定系統(tǒng)的缺省臨時(shí)表空間:

SQL> alter database default temporary tablespace temp;

表空間離線:

離線的表空間無(wú)法訪問,用于數(shù)據(jù)維護(hù)。

system表空間,有活動(dòng)undo段的表空間和缺省的臨時(shí)表空間不能置于離線狀態(tài)。

操作命令:

SQL> alter tablespace users offline;

Tablespace altered.

SQL> alter tablespace users online;

Tablespace altered.

將表空間置為只讀模式和讀寫模式:

SQL> alter tablespace users read only;

Tablespace altered.

SQL> alter tablespace users read write;

Tablespace altered.

刪除表空間:

SQL> drop tablespace userdat including contents and datafiles;

Tablespace dropped.

手工改變數(shù)據(jù)文件的大小:

SQL> alter database datafile '/home/oracle/oradata/gldb/users01.dbf' resize 20m;

Database altered.

添加數(shù)據(jù)文件到表空間:

SQL> alter tablespace users add datafile '/home/oracle/oradata/gldb/users02.dbf' size 1m;

Tablespace altered.

設(shè)置表空間數(shù)據(jù)文件的缺省位置:

SQL> alter system set db_create_file_dest = '/home/oracle/oradata/gldb';

System altered.

SQL> create tablespace userdat2 datafile size 2m;

Tablespace created.

[oracle@redhatoracle gldb]$ pwd

/home/oracle/oradata/gldb

[oracle@redhatoracle gldb]$ ls -l | grep userdat2

-rw-r----- 1 oracle oinstall 2105344 Dec 16 06:53 o1_mf_userdat2_2r69vob3_.dbf

獲得表空間和數(shù)據(jù)文件信息:

SQL> select * from v$tablespace;

SQL> select * from v$datafile;


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 宜都市| 红河县| 西吉县| 马山县| 吉木萨尔县| 澄城县| 双柏县| 博爱县| 安化县| 潼南县| 剑川县| 灌阳县| 阿图什市| 西充县| 新邵县| 青海省| 宽城| 岑巩县| 内江市| 香河县| 榆社县| 苏州市| 芜湖县| 比如县| 汤原县| 酒泉市| 杭州市| 屏山县| 腾冲县| 和静县| 祁门县| 新乡市| 沂南县| 高青县| 苍山县| 武清区| 会东县| 朝阳区| 康平县| 修水县| 陕西省|