2017-07-07 96 views
1

當我在Sybase ASE的使用sp_helpdb 15.7我的結果:如何關閉混合數據並登錄到Sybase ASE 15.7?

db_abc  2054.0 MB sa trunc log on chkpt, mixed log and data 
db_def  1030.0 MB sa trunc log on chkpt, mixed log and data 

我能關掉mixed log and data? 我試過sp_dboption db_abc , 'mixed log and data', false 但是顯示錯誤Sybase Database Error: The database option does not exist or you cannot set the option.雖然在其他情況下sp_dboption db_abc , 'abort tran on log full', false是好的。

回答

1

mixed log + data不是開關。這是數據庫創建方式的一種效果(以及頁面在同一區域中的混合方式)。您可以而不是將其關閉。您需要將數據中的LOG分開以實現您的目標。

既然你有兩個日誌和數據頁當前設備上,你需要:

  • 添加僅日誌(alter database .. log on ..
  • 開關single user模式
  • 移動計劃其他設備登錄到新創建的設備與過程sp_logdevice
  • 開關關閉single user模式

代碼示例:

1> disk init name = dev1, physname = '/tmp/dev1.dat', size = '200M' 
2> go 
create database db_abc on dev1 = '200M' 
2> go 
CREATE DATABASE: allocating 102400 logical pages (200.0 megabytes) on disk 'dev1' (102400 logical pages requested). 
Database 'db_abc' is now online. 
1> exec sp_dboption 'db_abc', 'trunc log on chkpt', true 
2> go 
Database option 'trunc log on chkpt' turned ON for database 'db_abc'. 
Running CHECKPOINT on database 'db_abc' for option 'trunc log on chkpt' to take effect. 
(return status = 0) 
1> exec sp_helpdb 'db_abc' 
2> go 
name db_size  owner dbid created  durability lobcomplvl inrowlen status         
------ ------------- ----- ---- ------------ ---------- ---------- -------- -------------------------------------- 
db_abc  200.0 MB sa  4 Jul 07, 2017 full    0  NULL trunc log on chkpt, mixed log and data 

(1 row affected) 

device_fragments size   usage  created    free_kbytes  
---------------- ------------- ------------ ------------------- ---------------- 
dev1     200.0 MB data and log Jul 7 2017 9:56AM   202232 
(return status = 0) 
1> disk init name = dev2, physname = '/tmp/dev2.dat', size = '100M' 
2> go 
1> alter database db_abc log on dev2 = '100M' 
2> go 
Extending database by 51200 pages (100.0 megabytes) on disk dev2 
Warning: Using ALTER DATABASE to extend the log segment will cause user thresholds on the log segment within 128 pages of the last chance threshold to be disabled. 
1> exec sp_dboption 'db_abc', 'single user', true 
2> go 
Database option 'single user' turned ON for database 'db_abc'. 
Running CHECKPOINT on database 'db_abc' for option 'single user' to take effect. 
(return status = 0) 
1> exec sp_logdevice 'db_abc', 'dev2' 
2> go 
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role. 
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role. 
syslogs moved. 
The last-chance threshold for database db_abc is now 16 pages. 
(return status = 0) 
1> exec sp_dboption 'db_abc', 'single user', false 
2> go 
Database option 'single user' turned OFF for database 'db_abc'. 
Running CHECKPOINT on database 'db_abc' for option 'single user' to take effect. 
(return status = 0) 
1> exec sp_helpdb 'db_abc' 
2> go 
name db_size  owner dbid created  durability lobcomplvl inrowlen status         
------ ------------- ----- ---- ------------ ---------- ---------- -------- -------------------------------------- 
db_abc  300.0 MB sa  4 Jul 07, 2017 full    0  NULL trunc log on chkpt, mixed log and data 

(1 row affected) 

device_fragments size   usage  created    free_kbytes  
---------------- ------------- --------- ------------------- ---------------- 
dev1     200.0 MB data only Jul 7 2017 9:56AM   202248 
dev2     100.0 MB log only Jul 7 2017 9:57AM not applicable 

-------------------------------------------------------------------------------------------------------------- 
log only free kbytes = 102000                     
(return status = 0) 
+0

我們將存儲數據和日誌中2,其中和'TRUN登錄on'確保日誌將關閉 – Adam