一、測試需求背景
1、有沒有問我初始化參數修改之後是否可以立即生效,立即做了一個測試,結論是,可以。
2、linux系統下,Oracle資料區塊預設8K,能支援的資料檔案最大32G,想使用64G的就需要修改初始化參數 db_16k_cache_size
3、順便複習總結了一下資料表空間相關基礎概念:
1)同一個資料庫內可以設定不同block大小,來設定不同大小的資料檔案,有時候業務有這個需求。
2)同一個資料表空間只能使用同一種block
3)spfile啟動的資料庫,可以使用scope=both使得參數立即在記憶體中生效,但是要注意前提,pfile啟動的庫不行。
二、測試過程
SQL> show parameter block
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_buffers integer 0
db_block_checking string FALSE
db_block_checksum string TYPICAL
db_block_size integer 8192
db_file_multiblock_read_count integer 128
SQL> show parameter db_16k
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_16k_cache_size big integer 0
SQL> alter system set db_16k_cache_size=34603008 scope=spfile;
System altered.
SQL>
SQL>
SQL> commit;
Commit complete.
SQL>
SQL> alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G;
alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G
*
ERROR at line 1:
ORA-01144: File size (5242880 blocks) exceeds maximum of 4194303 blocks
SQL> alter system set db_16k_cache_size=34603008 scope=both;
System altered.
SQL> alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G blocksize 16k;
alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G blocksize 16k
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
SQL> create tablespace aaa datafile '/oracle/oradata/aa.dbf' size 40G blocksize 16k;
Tablespace created.
SQL> SQL> SQL> host du -sh /oracle/oradata/aa.dbf
41G /oracle/oradata/aa.dbf
三、scope參數詳解
SCOPE = SPFILE
The change is applied in the server parameter file only. The effect is as follows:
■ For dynamic parameters, the change is effective at the next startup and is persistent.
■ For static parameters, the behavior. is the same as for dynamic parameters. This is the only SCOPE specification allowed for static parameters.
(此更改寫入初始化參數檔案,更改將在下次啟動時生效。動態參數與靜態參數都一樣可以。也是靜態參數唯一可以使用的方式。)
必須是spfile啟動的資料庫才可以啊。不然報錯
SCOPE = MEMORY
The change is applied in memory only. The effect is as follows:
■ For dynamic parameters, the effect is immediate, but it is not persistent because the server parameter file is not updated.
■ For static parameters, this specification is not allowed.
(只在記憶體上修改,立即生效,但重啟後將不再生效,因為並沒有寫入到初始化參數檔案。只適用於動態參數,靜態參數則不允許。)
用於不是spfile啟動的資料庫上面。下次啟動如果用spfile,就失效了。
SCOPE = BOTH
The change is applied in both the server parameter file and memory. The effect is as follows:
■ For dynamic parameters, the effect is immediate and persistent.
■ For static parameters, this specification is not allowed.
(既寫入到初始化參數檔案,也在記憶體上修改,立即生效。同樣也只適用於動態參數,靜態參數則不允許。)
必須是spfile啟動的資料庫才可以啊。不然報錯
Oracle scope/sid/deferred/reset 總結說明