ftp到ASM磁碟組路徑錯誤的問題
由於ASM磁碟組訪問比較麻煩,因此透過FTP的方式,將資料檔案複製到ASM磁碟組中,結果不小心導致資料檔案複製到錯誤的目錄下。
透過FTP訪問ASM磁碟組:http://yangtingkun.itpub.net/post/468/470778
當時FTP的操作型別下面的例子:
bash-3.00$ ftp 172.0.2.62 7788
Connected to 172.0.2.62.
220- ser1
Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution.
220 ser1 FTP Server (Oracle XML DB/Oracle Database) ready.
Name (172.0.2.62:oracle): system
331 pass required for SYSTEM
Password:
230 SYSTEM logged in
Remote system type is Unix.
ftp> bin
200 Type set to I.
ftp> prompt
Interactive mode off.
ftp> mput test01.dbf
200 PORT Command successful
150 BIN Data Connection
226 BIN Transfer Complete
local: test01.dbf remote: test01.dbf
104890368 bytes sent in 9.3 seconds (11014.97 Kbytes/s)
由於忘記了指定目標路徑,因此資料檔案放到了錯誤的路徑中。需要注意當前的路徑可不是ASM磁碟組DATA的跟目錄下,而是處於一個奇怪的位置中:
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
OLAP_XDS
images
olap_data_security
public
sys
sysaux01.dbf
temp01.dbf
test01.dbf
undotbs01.dbf
users01.dbf
xdbconfig.xml
yangtk01.dbf
226 ASCII Transfer Complete
146 bytes received in 0.00061 seconds (233.12 Kbytes/s)
ftp> cd sys
250 CWD Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
acloids
acls
apps
asm
log
oid
principals
schemas
version
workspaces
xs
226 ASCII Transfer Complete
82 bytes received in 0.0005 seconds (159.52 Kbytes/s)
ftp> cd asm
250 CWD Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
DATA
226 ASCII Transfer Complete
6 bytes received in 0.16 seconds (0.04 Kbytes/s)
在當前目錄下,進入sys目錄,然後進入asm目錄,這時出現的是DATA磁碟組目錄,在進入到DATA目錄後,訪問的才是ASM磁碟組。
那麼現在資料檔案被放到哪裡了。顯然不是作業系統上,在作業系統上進行搜尋找不到這些資料檔案:
root@ser1 # find / -name 'test01.dbf'
find: stat() error /proc/8117: No such file or directory
root@ser1 #
根據ASM的FTP訪問配置,透過FTP訪問ASM要藉助XDB的功能,莫非資料檔案被傳送到資料庫中:
bash-3.00$ export ORACLE_SID=ractest1
bash-3.00$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on 星期日 8月 9 20:57:44 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> set pages 100 lines 120
SQL> select owner, sum(bytes)/1024/1024/1024
2 from dba_segments
3 group by owner
4 having sum(bytes)/1024/1024/1024 > 1
5 order by 2 desc;
OWNER SUM(BYTES)/1024/1024/1024
------------------------------ -------------------------
XDB 9.32232666
SYS 1.17749023
SQL> select segment_name, sum(bytes)/1024/1024/1024
2 from dba_segments
3 where wner = 'XDB'
4 group by segment_name
5 having sum(bytes)/1024/1024 > 500;
SEGMENT_NAME SUM(BYTES)/1024/1024/1024
----------------------------------------- -------------------------
SYS_LOB0000054787C00025$$ 9.25
SQL> select object_name, object_type
2 from dba_objects
3 where wner = 'XDB'
4 and object_name = 'SYS_LOB0000054787C00025$$';
OBJECT_NAME OBJECT_TYPE
------------------------------ -------------------
SYS_LOB0000054787C00025$$ LOB
SQL> select table_name, column_name, segment_name, tablespace_name
2 from dba_lobs
3 where wner = 'XDB'
4 and segment_name = 'SYS_LOB0000054787C00025$$';
TABLE_NAME COLUMN_NAME SEGMENT_NAME TABLESPACE_NAME
--------------- -------------------- ------------------------------ ---------------
XDB$RESOURCE "XMLDATA"."XMLLOB" SYS_LOB0000054787C00025$$ SYSAUX
果然,檔案被放到了XDB使用者下XDB$RESOURCE表的LOB列中,檢查這個表的結構:
SQL> DESC XDB.XDB$RESOURCE
名稱 是否為空? 型別
----------------------------------------------------------------- -------- -----------
TABLE of XMLTYPE(XMLSchema "" Element "Resource") STORAGE Object-relational TYPE "XDB$RESOURCE_T"
SQL> DESC XDB.XDB$RESOURCE_T
名稱 是否為空? 型別
------------------------------------ -------- ----------------
VERSIONID NUMBER(38)
CREATIONDATE TIMESTAMP(6)
MODIFICATIONDATE TIMESTAMP(6)
AUTHOR VARCHAR2(128)
DISPNAME VARCHAR2(128)
RESCOMMENT VARCHAR2(128)
LANGUAGE VARCHAR2(128)
CHARSET VARCHAR2(128)
CONTYPE VARCHAR2(128)
REFCOUNT RAW(4)
LOCKS RAW(2000)
ACLOID RAW(16)
OWNERID RAW(16)
CREATORID RAW(16)
LASTMODIFIERID RAW(16)
ELNUM NUMBER(38)
SCHOID RAW(16)
XMLREF REF OF XMLTYPE
XMLLOB BLOB
FLAGS RAW(4)
RESEXTRA CLOB
ACTIVITYID NUMBER(38)
VCRUID RAW(16)
PARENTS XDB.XDB$PREDECESSOR_LIST_T
SBRESEXTRA XDB.XDB$XMLTYPE_REF_LIST_T
SNAPSHOT RAW(6)
ATTRCOPY BLOB
CTSCOPY BLOB
NODENUM RAW(6)
SIZEONDISK NUMBER(38)
RCLIST XDB.XDB$RCLIST_T
CHECKEDOUTBYID RAW(16)
BASEVERSION RAW(16)
SQL> SET LONG 100000
SQL> SELECT DBMS_METADATA.GET_DDL('TABLE', 'XDB$RESOURCE', 'XDB') FROM DUAL;
DBMS_METADATA.GET_DDL('TABLE','XDB$RESOURCE','XDB')
--------------------------------------------------------------------------------
CREATE TABLE "XDB"."XDB$RESOURCE" OF "SYS"."XMLTYPE"
( REF ("XMLDATA"."XMLREF") WITH ROWID,
REF ("XMLDATA"."XMLREF") ALLOW PRIMARY KEY
)
XMLSCHEMA "" ELEMENT "Resource" ID 734 PCTFRE
E 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSAUX"
LOB ("XMLDATA"."XMLLOB") STORE AS BASICFILE (
TABLESPACE "SYSAUX" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
NOCACHE LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
LOB ("XMLDATA"."RESEXTRA") STORE AS BASICFILE (
TABLESPACE "SYSAUX" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
NOCACHE LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
LOB ("XMLDATA"."ATTRCOPY") STORE AS BASICFILE (
TABLESPACE "SYSAUX" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
NOCACHE LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
LOB ("XMLDATA"."CTSCOPY") STORE AS BASICFILE (
TABLESPACE "SYSAUX" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
NOCACHE LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
顯然這又是一個複雜的XML物件表,由於對XML物件不熟悉,因此還是透過FTP命令來解決這個問題:
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
OLAP_XDS
images
olap_data_security
public
sys
sysaux01.dbf
temp01.dbf
test01.dbf
undotbs01.dbf
users01.dbf
xdbconfig.xml
yangtk01.dbf
226 ASCII Transfer Complete
146 bytes received in 0.00048 seconds (298.97 Kbytes/s)
ftp> delete sysaux01.dbf
250 DELE Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
OLAP_XDS
images
olap_data_security
public
sys
temp01.dbf
test01.dbf
undotbs01.dbf
users01.dbf
xdbconfig.xml
yangtk01.dbf
226 ASCII Transfer Complete
132 bytes received in 0.00038 seconds (339.76 Kbytes/s)
ftp> delete temp01.dbf
250 DELE Command successful
ftp> delete test01.dbf
250 DELE Command successful
ftp> del undotbs01.dbf
250 DELE Command successful
ftp> del users01.dbf
250 DELE Command successful
ftp> del yangtk01.dbf
250 DELE Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
OLAP_XDS
images
olap_data_security
public
sys
xdbconfig.xml
226 ASCII Transfer Complete
66 bytes received in 0.00027 seconds (243.13 Kbytes/s)
現在錯誤的資料檔案已經被清除掉了,不過資料庫中的LOB欄位的大小還沒有恢復:
SQL> SELECT SEGMENT_NAME, BYTES/1024/1024/1024
2 FROM DBA_SEGMENTS
3 WHERE WNER = 'XDB'
4 AND SEGMENT_NAME = 'SYS_LOB0000054787C00025$$';
SEGMENT_NAME BYTES/1024/1024/1024
------------------------------ --------------------
SYS_LOB0000054787C00025$$ 9.37988281
SQL> ALTER TABLE XDB.XDB$RESOURCE MOVE;
表已更改。
SQL> SELECT SEGMENT_NAME, BYTES/1024/1024/1024
2 FROM DBA_SEGMENTS
3 WHERE WNER = 'XDB'
4 AND SEGMENT_NAME = 'SYS_LOB0000054787C00025$$';
SEGMENT_NAME BYTES/1024/1024/1024
------------------------------ --------------------
SYS_LOB0000054787C00025$$ .03125
顯然恢復了XDB$RESOURCE表的大小,但是XDB表空間的大小還沒有恢復:
SQL> SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024/1024
2 FROM DBA_DATA_FILES
3 WHERE TABLESPACE_NAME = 'SYSAUX';
TABLESPACE_NAME FILE_NAME BYTES/1024/1024/1024
--------------- --------------------------------------------- --------------------
SYSAUX +DATA/ractest/datafile/sysaux.260.664395357 10.7851563
SQL> ALTER DATABASE DATAFILE '+DATA/ractest/datafile/sysaux.260.664395357' RESIZE 4G;
ALTER DATABASE DATAFILE '+DATA/ractest/datafile/sysaux.260.664395357' RESIZE 4G
*
第 1 行出現錯誤:
ORA-03297: 檔案包含在請求的 RESIZE 值以外使用的資料
導致這個錯誤的原因是由於雖然XDB$RESOURCE表所佔用的空間已經被釋放,但是釋放的空間在資料檔案的中部,資料檔案的最後部分是MOVE得到的新的XDB$RESOURCE表,因此無法RESIZE空間。
SQL> ALTER TABLE XDB.XDB$RESOURCE MOVE;
表已更改。
SQL> ALTER DATABASE DATAFILE '+DATA/ractest/datafile/sysaux.260.664395357' RESIZE 4G;
資料庫已更改。
再次執行MOVE操作後,XDB$RESOURCE表被移動到資料檔案靠前的位置,使得資料檔案的空間可以釋放,至此由於FTP錯誤導致的問題全部解決。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4227/viewspace-612407/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ASM磁碟組限制ASM
- 遷移ASM磁碟組ASM
- ASM磁碟組更換磁碟的操作方法ASM
- ASM 磁碟組的建立及擴容ASM
- 【ASM】Oracle asm磁碟被格式化,如何掛載該磁碟組ASMOracle
- 【ASM】Oracle asm刪除磁碟組注意事項ASMOracle
- 一次ASM新增新的磁碟組ASM
- 路徑問題
- 從定位資料塊所在ASM磁碟到ASM strippingASM
- (grid重灌後圖形介面報錯)ASM磁碟組字元介面配置ASM字元
- ASM磁碟組擴容操作文件ASM
- ORACLE ASM磁碟組空間溢位OracleASM
- 使用udev擴充套件ASM磁碟組dev套件ASM
- Db2 位元組問題&Db2-4229 錯誤問題DB2
- asm磁碟組依賴導致資料庫自啟動報錯ASM資料庫
- 【Azure 應用服務】部署Jar到App Service for Linux,因啟動命令路徑配置錯誤而引起:( Application Error 問題JARAPPLinuxError
- Oracle ASM磁碟組擴容(AIX7.1)OracleASMAI
- ASM磁碟組ORA-15042 ORA-15096ASM
- ASM重新命名包含OCR/vote file的磁碟組ASM
- VsCode相對路徑的問題VSCode
- 資源路徑問題
- 遞迴路徑問題遞迴
- Oracle RAC ASM磁碟組擴容時遇到的VIP漂移OracleASM
- 基於裸裝置的ASM磁碟組擴容方案ASM
- mysql的時區錯誤問題MySql
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- [BUG反饋]二級目錄應用新增內容時上傳封面圖的路徑錯誤問題
- django建立的專案路徑問題Django
- python中的路徑問題彙總Python
- 使用 PyExecJS2 庫時 js 引用包的模組路徑問題JS
- 演算法——路徑問題演算法
- RAC之grid叢集安裝及ASM磁碟組配置ASM
- 解決 ngrok 的 Domain 錯誤問題AI
- QML中載入圖片不顯示,路徑出錯問題
- vue 關於圖片路徑的問題Vue
- 遷移Qt專案的路徑問題QT
- 檔案路徑問題( ./ 和 ../ 和 @/ )
- 問題:未清空磁碟被新增到磁碟組觸發壞塊
- 遷移OCR和VotingDisk並刪除原ASM磁碟組ASM