測試alter table storage及dbms_space_admin包
###測試alter table storage及dbms_space_admin包(本地管理表空間local及auto segment space management)
SQL> create table test_storage(a int,b int) storage(initial 40k next 40k pctincrease 5 minextents 1 maxextents 1000);--顯式指定storage儲存屬性建表
Table created.
SQL> desc user_segments;
Name Null? Type
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------
----------------------------------------------------------------------------------------------
SEGMENT_NAME VARCHAR2(81)
PARTITION_NAME VARCHAR2(30)
SEGMENT_TYPE VARCHAR2(18)
TABLESPACE_NAME VARCHAR2(30)
BYTES NUMBER
BLOCKS NUMBER
EXTENTS NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENTS NUMBER
MAX_EXTENTS NUMBER
PCT_INCREASE NUMBER
FREELISTS NUMBER
FREELIST_GROUPS NUMBER
BUFFER_POOL VARCHAR2(7)
SQL> select segment_name,extents,initial_extent,next_extent,min_extents,max_extents,pct_increase from user_segments where segment_name='TEST_STORAGE';--oracle會自動對相關建表引數進行調整,比如max_extents(從
1000到2147483645)
SEGMENT_NAME EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE
--------------------------------------------------------------------------------- ---------- -------------- ----------- ----------- ----------- ------------
TEST_STORAGE 1 40960 1 2147483645
SQL> alter table test_storage storage(next 2000k);--不允許對錶儲存引數進行變更
alter table test_storage storage(next 2000k)
*
ERROR at line 1:
ORA-25150: ALTERING of extent parameters not permitted
SQL> alter table test_storage storage(pctincrease 20);---同上
alter table test_storage storage(pctincrease 20)
*
ERROR at line 1:
ORA-25150: ALTERING of extent parameters not permitted
SQL> select tablespace_name,extent_management,allocation_type,segment_space_management,pct_increase from user_tablespaces;--檢視錶所屬的表空間的extent及segment管理方式,各為local及auto
TABLESPACE_NAME EXTENT_MAN ALLOCATIO SEGMEN PCT_INCREASE
------------------------------ ---------- --------- ------ ------------
SYSTEM LOCAL SYSTEM MANUAL
UNDOTBS1 LOCAL SYSTEM MANUAL
SYSAUX LOCAL SYSTEM AUTO
TEMP LOCAL UNIFORM MANUAL 0
USERS LOCAL SYSTEM AUTO
EYE LOCAL SYSTEM AUTO
6 rows selected.
#######摘錄相關錯誤如下
SQL> host oerr ora 25150
25150, 00000, "ALTERING of extent parameters not permitted"
// *Cause: An attempt was made to alter the extent parameters for a segment ###說明對於assm方式且以統一分式或自動分配extent的表空間,不能進行變更屬性操作的
// in a tablespace with autoallocate or uniform. extent allocation
// policy.
// *Action: Remove the appropriate extent parameters from the command.
SQL> exec dbms_space_admin.tablespace_migrate_from_local('EYE');---用包dbms_space_admin把表空間eye從本地管理方式轉化為字典管理方式,失敗
BEGIN dbms_space_admin.tablespace_migrate_from_local('EYE'); END;
*
ERROR at line 1:
ORA-10616: Operation not allowed on this tablespace
ORA-06512: at "SYS.DBMS_SPACE_ADMIN", line 216
ORA-06512: at line 1
SQL> host oerr ora 10616 --查閱以上錯誤,提示不能對auto segment空間管理方式進行以上轉化操作
10616, 00000, "Operation not allowed on this tablespace"
// *Cause: Cannot perform. the operation on tablespace with AUTO
// SEGMENT SPACE MANAGEMENT
// *Action: Recheck the tablespace name and re-issue the statement
SQL> exec dbms_space_admin.tablespace_migrate_from_local(upper('undotbs1'));--不允許對undotbs表空間進行轉化操作
BEGIN dbms_space_admin.tablespace_migrate_from_local(upper('undotbs1')); END;
*
ERROR at line 1:
ORA-30021: Operation not allowed on undo tablespace
ORA-06512: at "SYS.DBMS_SPACE_ADMIN", line 216
ORA-06512: at line 1
SQL> create tablespace test_tbs datafile '/oracle/oradata/test_tbs.dbf' size 100m segment space management manual;--無奈,我就新建一個auto segment space management方式的本地local管理表空間
Tablespace created.
SQL> select tablespace_name,extent_management,allocation_type,segment_space_management,pct_increase from user_tablespaces where tablespace_name='TEST_TBS';--查新建的表空間test_storage
TABLESPACE_NAME EXTENT_MAN ALLOCATIO SEGMEN PCT_INCREASE
------------------------------ ---------- --------- ------ ------------
TEST_TBS LOCAL SYSTEM MANUAL
SQL> exec dbms_space_admin.tablespace_migrate_from_local('TEST_TBS');--再次轉化還是不成
BEGIN dbms_space_admin.tablespace_migrate_from_local('TEST_TBS'); END;
*
ERROR at line 1:
ORA-12914: Cannot migrate tablespace to dictionary managed type
ORA-06512: at "SYS.DBMS_SPACE_ADMIN", line 216
ORA-06512: at line 1
SQL> host oerr ora 12914 ##查閱錯誤,說明只要system表空間是本地管理方式,就不能把表空間轉化為字典管理方式,暈
12914, 00000, "Cannot migrate tablespace to dictionary managed type"
// *Cause: Attemp to migrate locally managed tablespace to dictionary managed
// type when the database has locally managed system tablespace.
// *Action: Command cannot be issued.
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-672039/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql的ALTER TABLE命令MySql
- alter table set unused column
- create table,show tables,describe table,DROP TABLE,ALTER TABLE ,怎麼使用?
- alter table move與shrink space
- alter table nologging /*+APPEND PARALLEL(n)*/APPParallel
- alter table drop unused columns checkpoint
- Azure Storage 系列(四)在.Net 上使用Table Storage
- ALTER TABLE修改列的不同方法
- MySQL-ALTER TABLE命令學習[20180503]MySql
- Azure Storage 系列(五)通過Azure.Cosmos.Table 類庫在.Net 上使用 Table Storage
- [20191129]ALTER TABLE MINIMIZE RECORDS_PER_BLOCK.txtBloC
- MySQL中的alter table命令的基本使用方法及提速最佳化MySql
- Kunlun-Storage vs PostgreSQL OLTP 測試SQL
- Azure Table Storage(一) : 簡單介紹
- 測試本地node包
- iperf測試抓包
- MySQL alter table時執行innobackupex全備再看Seconds_Behind_MasterMySqlAST
- 透過alter table 來實現重建表,同事大呼開眼界了
- iOS打測試包與分發測試iOS
- 有關oracle external table的一點測試。Oracle
- 資料包表測試
- 性格及智商測試
- Oracle 12.2之後ALTER TABLE .. MODIFY轉換非分割槽表為分割槽表Oracle
- 黑盒測試策略及測試範圍(web端)Web
- 測試 iris 時自定義 context 包Context
- 自定義 Composer 包 dome 小測試
- 【Azure 儲存服務】Python模組(azure.cosmosdb.table)直接對錶儲存(Storage Account Table)做操作示例Python
- 今天測試了一下update partition table的part key
- npm模組管理-區分測試包和穩定包NPM
- SQL__ALTERSQL
- MySQL ALTER命令MySql
- SpringBoot+redis配置及測試Spring BootRedis
- 常見埠及安全測試
- JavaScript單元測試及原理JavaScript
- web自動化測試框架-05 建立資料驅動的測試用例,Doc String與Data TableWeb框架
- 探索 Go1.16 io/fs 包以提高測試效能和可測試性Go
- 聊聊flink Table的OrderBy及LimitMIT
- 線上改表工具oak-online-alter-table和pt-online-schema-change的使用限制總結
- Rust效能分析之測試及火焰圖,附(lru,lfu,arc)測試Rust