[20190324]奇怪的GV$FILESPACE_USAGE檢視.txt
[20190324]奇怪的GV$FILESPACE_USAGE檢視.txt
--//發現GV$FILESPACE_USAGE定義很奇怪,做一個記錄.
1.環境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
--//GV$FILESPACE_USAGE的定義如下:
SCOTT@book> select VIEW_NAME,VIEW_DEFINITION c100 from V$FIXED_VIEW_DEFINITION where view_name='GV$FILESPACE_USAGE';
VIEW_NAME C100
------------------------------ ----------------------------------------------------------------------------------------------------
GV$FILESPACE_USAGE SELECT inst_id, KTTEFINFOTSN, KTTEFINFOFNO, KTTEFINFOUSP, KTTEFINFOSIZE, KTTEFINFOMSIZE, KT
TEFINFOSCNB, KTTEFINFOSCNW, KTTEFINFOFLAG FROM X$KTTEFINFO
--//整理如下:
SELECT inst_id
,KTTEFINFOTSN
,KTTEFINFOFNO
,KTTEFINFOUSP
,KTTEFINFOSIZE
,KTTEFINFOMSIZE
,KTTEFINFOSCNB
,KTTEFINFOSCNW
,KTTEFINFOFLAG
FROM X$KTTEFINFO;
2.增加資料檔案:
ALTER TABLESPACE UNDOTBS1
ADD DATAFILE '/mnt/ramdisk/book/undotbs02.dbf'
SIZE 16M
AUTOEXTEND OFF;
SCOTT@book> SELECT file#,ts#,rfile#,name,blocks,bytes FROM v$datafile;
FILE# TS# RFILE# NAME BLOCKS BYTES
----- --- ------ -------------------------------- ------ ------------
1 0 1 /mnt/ramdisk/book/system01.dbf 97280 796917760
2 1 2 /mnt/ramdisk/book/sysaux01.dbf 120320 985661440
3 2 3 /mnt/ramdisk/book/undotbs01.dbf 110720 907018240
4 4 4 /mnt/ramdisk/book/users01.dbf 16384 134217728
5 6 5 /mnt/ramdisk/book/example01.dbf 44320 363069440
6 7 6 /mnt/ramdisk/book/tea01.dbf 5120 41943040
7 2 7 /mnt/ramdisk/book/undotbs02.dbf 2048 16777216
7 rows selected.
SCOTT@book> select * from GV$FILESPACE_USAGE;
INST_ID TABLESPACE_ID RFNO ALLOCATED_SPACE FILE_SIZE FILE_MAXSIZE CHANGESCN_BASE CHANGESCN_WRAP FLAG
------- ------------- ------------ --------------- ------------ ------------ -------------- -------------- ----
1 0 1 96112 97280 4194302 395636096 3 2
1 1 2 107392 120320 4194302 395638024 3 2
1 2 1 2936 110720 664925 395639290 3 6
1 3 1 256 52992 52992 395639290 3 6
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 4 4 1904 16384 4194302 395637154 3 2
1 6 5 39704 44320 4194302 395636096 3 2
1 7 6 128 5120 4194302 395636096 3 2
7 rows selected.
--//RFNO根本沒有7.視乎表示的含義與rfile#不同.奇怪?視乎相同的表空間RFNO一樣.
--//TABLESPACE_ID到底表示什麼.亂.
--//GV$FILESPACE_USAGE.FILE_SIZE應該與datafile.BLOCKS一致,但是看下劃線這行應該對應/mnt/ramdisk/book/undotbs02.dbf
--//但是大小對不上很奇怪,單位是塊不是位元組,這個檢視很奇怪,不建議使用.
--//視乎flga=6表示undo表空間的資料檔案.
--//再增加資料檔案看看:
ALTER TABLESPACE UNDOTBS1
ADD DATAFILE '/mnt/ramdisk/book/undotbs03.dbf'
SIZE 16M
AUTOEXTEND OFF;
SCOTT@book> select * from GV$FILESPACE_USAGE;
INST_ID TABLESPACE_ID RFNO ALLOCATED_SPACE FILE_SIZE FILE_MAXSIZE CHANGESCN_BASE CHANGESCN_WRAP FLAG
------- ------------- ---- --------------- ------------ ------------ -------------- -------------- ----
1 0 1 96112 97280 4194302 395636096 3 2
1 1 2 107392 120320 4194302 395640371 3 2
1 2 1 2560 112768 664919 395643160 3 6
1 3 1 256 52992 52992 395643160 3 6
1 4 4 1904 16384 4194302 395637154 3 2
1 6 5 39704 44320 4194302 395636096 3 2
1 7 6 128 5120 4194302 395636096 3 2
7 rows selected.
--//還是7條記錄
SCOTT@book> SELECT file#,ts#,rfile#,name,blocks,bytes FROM v$datafile;
FILE# TS# RFILE# NAME BLOCKS BYTES
----- --- ------ -------------------------------- ------ ------------
1 0 1 /mnt/ramdisk/book/system01.dbf 97280 796917760
2 1 2 /mnt/ramdisk/book/sysaux01.dbf 120320 985661440
3 2 3 /mnt/ramdisk/book/undotbs01.dbf 110720 907018240
4 4 4 /mnt/ramdisk/book/users01.dbf 16384 134217728
5 6 5 /mnt/ramdisk/book/example01.dbf 44320 363069440
6 7 6 /mnt/ramdisk/book/tea01.dbf 5120 41943040
7 2 7 /mnt/ramdisk/book/undotbs02.dbf 2048 16777216
8 2 8 /mnt/ramdisk/book/undotbs03.dbf 2048 16777216
8 rows selected.
--//重啟資料庫看看:
SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@book> startup
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
Redo Buffers 7487488 bytes
Database mounted.
Database opened.
SYS@book> select * from GV$FILESPACE_USAGE;
INST_ID TABLESPACE_ID RFNO ALLOCATED_SPACE FILE_SIZE FILE_MAXSIZE CHANGESCN_BASE CHANGESCN_WRAP FLAG
------------ ------------- ------------ --------------- ------------ ------------ -------------- -------------- ------------
1 0 1 96112 97280 4194302 395645171 3 2
1 1 2 107392 120320 4194302 395645171 3 2
1 2 1 2720 114816 664914 395645171 3 6
1 3 1 128 52992 52992 395645171 3 6
1 4 4 1904 16384 4194302 395645171 3 2
1 6 5 39704 44320 4194302 395645171 3 2
1 7 6 128 5120 4194302 395645171 3 2
7 rows selected.
--//依舊是7行.
3.再看看看CHANGESCN_WRAP:
--//CHANGESCN_WRAP有表示什麼?表示scn的wrap嗎?我查詢生產系統如下:
set linesize 200
select * from GV$FILESPACE_USAGE where rownum<=10;
INST_ID TABLESPACE_ID RFNO ALLOCATED_SPACE FILE_SIZE FILE_MAXSIZE CHANGESCN_BASE CHANGESCN_WRAP FLAG
---------- ------------- ---------- --------------- ---------- ------------ -------------- -------------- ----------
1 0 1 96000 96000 4194302 2895231817 3 2
1 0 29 9848 512000 512000 1524748330 6 2
1 1 2 66560 66560 4194302 1658426615 6 2
1 1 28 412112 512000 512000 1682050392 6 2
1 2 1 85232 5760000 10948604 1682775853 6 6
1 3 1 107520 4194176 4194302 1682775853 6 6
1 4 4 473656 2439840 4194302 1459217743 6 2
1 5 1 17456 5760000 10948604 1682654360 6 6
1 6 6 1541808 1622016 4194302 1608398721 6 2
1 7 7 4194303 4194303 4194303 1190175374 5 2
--//CHANGESCN_WRAP有6,3,5,表示什麼??
總結:
--//總之這個檢視很奇怪,不建議使用,視乎在查詢undo表空間上有問題,細節我探究了.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2639220/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20211214]檢視檢視V$ACTIVE_SESSION_HISTORY遇到奇怪問題.txtSession
- v$parameter gv$parameter 檢視 DDL 與隱含引數
- [20230905]奇怪的語法.txt
- [20221020]奇怪的增量備份.txt
- [20220822]奇怪的ashtop輸出.txt
- [20211111]奇怪的ashtop輸出.txt
- [20210802]grep奇怪的過濾.txt
- [20210924]awk奇怪的輸出.txt
- [20201106]奇怪的awr報表.txt
- [20181120]奇怪的insert語句.txt
- [20240911]檢視超長檢視的定義2.txt
- [20231012]奇怪的執行時長.txt
- [20230426]奇怪的AVG_IOW_MS.txt
- [20190306]奇怪的查詢結果.txt
- [20221103]奇怪的mail資訊(整理版本).txtAI
- [20211018]奇怪的歸檔目的地.txt
- [20210924]awk奇怪的輸出2.txt
- [20211210]優化遇到的奇怪問題.txt優化
- [20180417]奇怪的grep過濾問題.txt
- [20180503]檢視提示使用索引.txt索引
- [20211020]奇怪lsnrctl status顯示.txt
- [20210422]如何檢視字元的ascii編碼.txt字元ASCII
- [20190416]檢視shared latch gets的變化.txt
- [20231124]奇怪的高邏輯讀4.txt
- [20230405]奇怪的顯示輸出寬度.txt
- [20230216]奇怪的高邏輯讀3.txt
- [20220811]奇怪的隱式轉換問題.txt
- [20230323]ps命令檢視thread.txtthread
- [20211019]V$DETACHED_SESSION檢視.txtSession
- [20211026]奇怪註解不起作用.txt
- [20210208][20200426]檢視shared latch gets的變化.txt
- [20210420]19c奇怪的過濾條件.txt
- [20181201]奇怪的INDEX SKIP SCAN執行計劃.txtIndex
- [20210528]V$INDEXED_FIXED_COLUMN檢視.txtIndex
- [20210418]查詢v$檢視問題.txt
- [20231012]如何檢視unicode編碼內容.txtUnicode
- [20211206]toad下job建立檢視問題.txt
- [20210423]建立檢視以及欄位長度.txt