检查 sybase 中的 status2 值
Checking status2 value in sybase
我正在使用以下查询在 sybase 中获取 status2 值
select name, status, status2 FROM sysdatabases
获取 status2 值后,我将其转换为 16 位二进制值并检查第 4 位和第 5 位以检查数据库是否离线。
当数据库将 abort tran on log full 设置为 true 并且 status2 的值为 -32767 时,就会出现问题。这会将所有位设置为 1。我所遵循的检查数据库是否离线的方法是否正确?
我正在使用以下文档作为参考
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36274.1550/html/tables/X42615.htm
我在 SAP 社区收到了以下回复
1> create database test 2> go CREATE DATABASE: allocating 1536 logical
pages (3.0 megabytes) on disk 'master' (1536 logical pages requested).
Database 'test' is now online.
1> select convert(binary(2), status2), status2 from sysdatabases where
name = "test" 2> go status2
------ ------- 0x8000 -32768
(1 row affected) 1> sp_dboption test, 'abort tran', true 2> go
Database option 'abort tran on log full' turned ON for database
'test'. Running CHECKPOINT on database 'test' for option 'abort tran
on log full' to take effect. (return status = 0) 1> select
convert(binary(2), status2), status2 from sysdatabases where name =
"test" 2> go status2
------ ------- 0x8001 -32767
(1 row affected)
To test whether either "offline" bit was on, I would check if (status2
& 48 > 0 )
我正在使用以下查询在 sybase 中获取 status2 值
select name, status, status2 FROM sysdatabases
获取 status2 值后,我将其转换为 16 位二进制值并检查第 4 位和第 5 位以检查数据库是否离线。 当数据库将 abort tran on log full 设置为 true 并且 status2 的值为 -32767 时,就会出现问题。这会将所有位设置为 1。我所遵循的检查数据库是否离线的方法是否正确?
我正在使用以下文档作为参考 http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36274.1550/html/tables/X42615.htm
我在 SAP 社区收到了以下回复
1> create database test 2> go CREATE DATABASE: allocating 1536 logical pages (3.0 megabytes) on disk 'master' (1536 logical pages requested). Database 'test' is now online.
1> select convert(binary(2), status2), status2 from sysdatabases where name = "test" 2> go status2 ------ ------- 0x8000 -32768
(1 row affected) 1> sp_dboption test, 'abort tran', true 2> go Database option 'abort tran on log full' turned ON for database 'test'. Running CHECKPOINT on database 'test' for option 'abort tran on log full' to take effect. (return status = 0) 1> select convert(binary(2), status2), status2 from sysdatabases where name = "test" 2> go status2 ------ ------- 0x8001 -32767
(1 row affected)
To test whether either "offline" bit was on, I would check if (status2 & 48 > 0 )