Oracle

創建字典管理表空間 Oracle

  • November 20, 2018

我堅持在 11g Release 2 Oracle 32 位中創建字典管理表空間,我無法創建具有字典管理的普通表空間,因為我的系統表空間是本地管理的。有什麼方法可以將系統表空間創建為字典管理表空間?我嘗試在 oracle 中使用數據庫配置助手創建新數據庫,但找不到使用字典管理創建表空間系統的任何步驟。我注意到他們說

The DICTIONARY keyword is deprecated. It is still supported for backward compatibility.

https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_7003.htm#i2096553

我真的很困惑這條線。我不能完全理解它,我認為仍然有一種方法可以創建字典管理,因為我們有辦法從本地轉換為字典,反之亦然,但是如果系統表空間是本地管理的,我們就無法進行轉換。我只是甲骨文的新手。請大家給我一些建議好嗎?

創建數據庫

範圍管理子句::=

在此處輸入圖像描述

使用此子句創建本地管理的 SYSTEM 表空間。如果省略此子句,則 SYSTEM 表空間將由字典管理。

因此,要在 11.2 上使用字典管理的 SYSTEM 表空間創建數據庫:

[oracle@o61 ~]$ cat $ORACLE_HOME/dbs/init$ORACLE_SID.ora
*.audit_file_dest='/u01/app/oracle/admin/D112/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oradata/D112/control01.ctl','/oradata/D112/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='D112'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=D112XDB)'
*.filesystemio_options='setall'
*.open_cursors=300
*.pga_aggregate_target=268435456
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1073741824
*.undo_tablespace='UNDOTBS1'
[oracle@o61 ~]$

[oracle@o61 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 20 11:58:41 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2260088 bytes
Variable Size             331350920 bytes
Database Buffers          729808896 bytes
Redo Buffers                5517312 bytes

手動創建數據庫(我註釋了EXTENT MANAGEMENT LOCAL子句):

CREATE DATABASE D112
  USER SYS IDENTIFIED BY Oracle123
  USER SYSTEM IDENTIFIED BY Oracle123
  LOGFILE GROUP 1 ('/oradata/D112/redo01a.log') SIZE 100M BLOCKSIZE 512,
          GROUP 2 ('/oradata/D112/redo02a.log') SIZE 100M BLOCKSIZE 512,
          GROUP 3 ('/oradata/D112/redo03a.log') SIZE 100M BLOCKSIZE 512
  MAXLOGFILES 5
  MAXLOGMEMBERS 5
  MAXLOGHISTORY 1
  MAXDATAFILES 100
  CHARACTER SET AL32UTF8
  NATIONAL CHARACTER SET AL16UTF16
  --EXTENT MANAGEMENT LOCAL
  DATAFILE '/oradata/D112/system01.dbf' SIZE 325M REUSE
  SYSAUX DATAFILE '/oradata/D112/sysaux01.dbf' SIZE 325M REUSE
  DEFAULT TABLESPACE users
     DATAFILE '/oradata/D112/users01.dbf'
     SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
  DEFAULT TEMPORARY TABLESPACE tempts1
     TEMPFILE '/oradata/D112/temp01.dbf'
     SIZE 20M REUSE
  UNDO TABLESPACE undotbs1
     DATAFILE '/oradata/D112/undotbs01.dbf'
     SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

Database created.

SQL>

現在檢查 SYSTEM 表空間。此時我們沒有任何字典視圖,所以我需要直接查詢字典表:

SQL> select name, decode(ts.bitmapped, 0, 'DICTIONARY', 'LOCAL') from ts$ ts;

NAME                           DECODE(TS.
------------------------------ ----------
SYSTEM                         DICTIONARY
SYSAUX                         LOCAL
UNDOTBS1                       LOCAL
TEMPTS1                        LOCAL
USERS                          LOCAL

然後創建一個字典管理的表空間:

SQL> create tablespace dict_ts datafile '/oradata/D112/dictts01.dbf' size 100M 
    extent management dictionary;

Tablespace created.

SQL> select name, decode(ts.bitmapped, 0, 'DICTIONARY', 'LOCAL') from ts$ ts;

NAME                           DECODE(TS.
------------------------------ ----------
SYSTEM                         DICTIONARY
SYSAUX                         LOCAL
UNDOTBS1                       LOCAL
TEMPTS1                        LOCAL
USERS                          LOCAL
DICT_TS                        DICTIONARY

6 rows selected.

但不要這樣做,只需使用本地管理的表空間。

引用自:https://dba.stackexchange.com/questions/222958