Sybase常見報錯問題處理
Sybase常見報錯問題處理
目錄1.error (921)
報錯資訊:
Database '%.*s' has not been recovered yet - please wait and try again.
原因分析:Error921錯誤發生在資料庫服務啟動進行資料恢復時,由於某些異常導致恢復無法完成,資料庫被標記為“suspect”狀態。一般資料庫的921錯誤都是由於作業系統異常斷電、sybase ASE服務異常關閉導致。
解決辦法:
1、檢視裝置及裝置地址 sp_helpdevice 2、建新的日誌裝置 DISK INIT name = 'DEV_YWST_LOG01', physname = '/home/sybase/data/DEV_YWST_LOG01.dat' , size = '16G' GO 3、修改資料庫狀態為-32768 use master go sp_configure 'allow update',1 go update sysdatabases set status = -32768 where name = 'YWST' go 4、停資料庫,修改資料庫埠,啟資料庫(或者單使用者啟動編輯啟動指令碼在最後一行末尾新增-m) shutdown with nowait 5、掛載新的日誌空間 alter database YWST log on DEV_YWST_LOG01='16384M' 6、重建日誌 dbcc rebuild_log(YWST,1,1) 7、將資料庫狀態改為0 update sysdatabases set status = 0 where name = 'YWST' 8、重啟資料庫,檢視資料庫狀態是否為0,YWST日誌是否有空間 select * from sysdatabases where name = 'YWST' sp_helpdb YWST --YWST日誌是否有空間 9、將資料庫埠改回來,重啟資料庫(單使用者的方式去掉-m) use master go sp_configure 'allow update',0 go 10、新增資料庫屬性 sp_dboption YWST,'abort tran on log full',true GO sp_dboption YWST,'allow wide dol rows',true GO sp_dboption YWST,'ddl in tran',true GO sp_dboption YWST,'deallocate first text page',true GO sp_dboption YWST,'select into/bulkcopy/pllsort',true GO sp_dboption YWST,'trunc log on chkpt',true go checkpoint go
2.error (840)
報錯資訊:
error-840 error-208 Error (840) Device 'DEV_TEST' (with physical name '/home/sybase/data/DEV_TEST.dat', and virtual device number 13) has not been correctly activated at startup time. Please contact a user with System Administrator (SA) role. Error (208) DB_TEST..test not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
原因分析:該報錯是資料庫找不到對應的裝置檔案了,可能是路徑錯誤,或者修改了裝置路徑導致
解決辦法:
1、建立裝置測試
disk init name='DEV_TEST',size='10M',physname='/home/sybase/data/DEV_TEST.dat'
disk init name='DEV_TEST_LOG01',size='10M',physname='/home/sybase/data/DEV_TEST_LOG01.dat'
2、建立資料庫
CREATE database DB_TEST ON DEV_TEST='10M' log ON DEV_TEST_LOG01='10M'
online DATABASE DB_TEST
3、新增資料庫屬性
sp_dboption DB_TEST,'select into/bulkcopy/pllsort',true
GO
sp_dboption DB_TEST,'trunc log on chkpt',true
GO
sp_dboption DB_TEST,'abort tran on log full',true
GO
4、建立表,向裡面插入一條資料
CREATE TABLE DB_TEST..test(c_bh VARCHAR(100))
INSERT INTO DB_TEST..test VALUES ('sdf')
SELECT * FROM DB_TEST..test
5、將裝置檔案遷移到/home/sybase/data/rssddata下面,啟動資料庫後訪問報錯840
上面報錯的解決辦法
修改資料庫檔案的路徑,並且將系統表的路徑改成和遷移的路徑一樣,設定sybase有訪問許可權
use master
GO
sp_configure 'allow update',0
go
--修改裝置路徑
UPDATE sysdevices SET phyname = '/home/sybase/data/rssddata/DEV_TEST1.dat' WHERE name = 'DEV_TEST'
UPDATE sysdevices SET phyname = '/home/sybase/data/rssddata/DEV_TEST_LOG01.dat' WHERE name = 'DEV_TEST_LOG01'
6、需要重啟後正常
shutdown WITH nowait
7、驗證可以查詢,並且查詢系統表路徑也已經修改了。
SELECT * FROM sysdevices
3.error (691)
報錯資訊:
Error (691) Encountered invalid loqical paqe '0' while accessinq database 'YWST'(6),object 'syslogs'(8),index 'syslogs'(0),partition 'syslogs_8'(8). This is an internal system error.Please contact Sybase Technical Support.
原因分析:
生產環境的日誌用dbcc rebuild_log清理了2次了(參照error921處理),每次清理了隔一週,日誌又滿了
執行dump transaction清理還報錯,並且資料庫開啟了日誌自動清理auto truncate log
解決辦法:
經餘頭指點,是不是因為複製截斷點的原因導致的
使用sysloghsold可以檢視複製截斷點
上面的結果說明開啟第二截斷點了
禁用第二截斷點,然後在dump清理日誌就可以了。
使用dbcc settrunc(ltm,'ignore')禁用第二截斷點
tj2是不用開啟截斷點的,開啟截斷點後就會導致日誌不清理一直堆積,出現文章前面說的情況,一週左右將空間佔滿,清理後還是會佔滿。
4.error (103)
報錯資訊:
Error (103) The identifier that starts with 'i_xx13233333333333333333333333' is too long. Maximum length is 30.
原因分析:
索引的命名太長,導致建立索引失敗
解決辦法:
sybase12.5版本索引名的長度不能超過30位元組,sybase15版本以上索引名長度支援:255位元組
檢視現場資料庫版本是15.7,而且使用:
dbcc traceon(3604)
go
dbcc serverlimits
go
可以看到索引名支援的長度也是255:
Max length of table name : 255
Max length of partition name : 255
Max length of column name : 255
Max length of index name : 255
如此看來資料庫版本和支援的長度都沒問題,那為什麼會報這個錯呢?
原因和客戶端版本還有關係,客戶端版本太低導致了報這個錯。
使用isql在服務端登陸然後執行建立索引,沒問題。:
總結:
1、檢查資料庫版本如果低於15,那麼限制就是30位元組,所以只能修改索引長度
2、資料庫版本是15以上仍然報錯,那麼就檢查客戶端版本sqldbx之類的版本是否低於15
5.error(1767)
報錯資訊:
[Error Code: 1767, SQL State: S1000] Number of variable length columns exceeds limit of 254 for allpage locked tables. CREATE TABLE for 'GD_BM_CARD' failed.
解決辦法:
將資料庫的頁鎖模式修改為行鎖模式,原因是頁鎖模式的話支援的列有限制。
sp_configure 'lock scheme',1,'datarows'
6.error(8233)
報錯資訊:
Error (8233) REORG operation is in progress on the object 'T_HYDJXX' in database 'YWST'. Retry your query later.
原因分析:
重建索引期間無法更新統計資訊,會報錯,建議重建索引後更新統計資訊。