您的位置:首页 > 数据库

sybase ASA 数据库的表碎片 整理

2015-02-24 21:05 190 查看

sa_table_fragmentation 系统过程

报告数据库表的分段信息。

语法

sa_table_fragmentation(
[ tbl_name
[, owner_name ] ]
)


参数

tbl_name 使用此可选的 CHAR(128) 参数指定要检查其碎片的表的名称。

owner_name 使用此可选的 CHAR(128) 参数指定tbl_name 的所有者。

结果集

列名数据类型说明
TableNameCHAR(128)表的名称。
rowsUNSIGNED INTEGER表中的行数。
row_segmentsUNSIGNED BIGINT表中的行分段数。
segs_per_rowDOUBLE每行的分段数。
注释

数据库管理员可以使用此过程获取数据库表的分段信息。如果不提供参数,则为数据库中的所有表返回结果。

当数据库表的碎片过多时,可以运行 REORGANIZE TABLE 或重建数据库以减少表碎片并提高性能。

权限

DBA 特权

副作用



另请参见

减少表碎片
数据库重建
REORGANIZE TABLE 语句

示例

CALL sa_table_fragmentation( 'Products','GROUPO' );

2.

使用 SQL 识别和修正表碎片

也可以使用 SQL 识别和修正表碎片。

 ♦ 检查表碎片
1.

在 Sybase Central 的左窗格中,单击 app_profiling - DBA,然后单击 [文件] » [打开 Interactive SQL]。

2.

Interactive SQL 启动并连接到 app_profiling.db 数据库。

3.

4.

在 Interactive SQL 中,执行以下 SQL 语句来测试 Employees 表的表碎片:

5.

CALL sa_table_fragmentation( 'Employees' );

6.

如果 segs_per_row 列中的值(每行的分段数)大于 1.1,则存在表碎片。等级较高的碎片可能会对性能造成负面影响。

7.

8.

在 Interactive SQL 中,执行以下 REORGANIZE TABLE 语句来减少表碎片:

9.

REORGANIZE TABLE Employees;

10.

11.

您现在已经完成了有关诊断表碎片的教程部分。

12.

 另请参见
· sa_table_fragmentation 系统过程

· REORGANIZE TABLE 语句

· 减少表碎片

· 应用程序分析

· 自定义诊断跟踪级别

· 诊断跟踪

运行结果如下:



引用说明:

SQLAnywhere[ASA]数据库(以下简称ASA)中的数据库文件,是如何存储普通的表的记录行呢?插入、更新、删除时,记录行的存储会有什么变化? 了解了这些,才能更好的理解如何对ASA数据库进行调优,尤其是物理存储方面。

1. ASA数据库尽一切可能对数据行连续存储

数据库文件中小于单个页面的记录行总是存储在单个页里,如果当前页没有足够的空间容纳新的记录行,数据库会将新行写到新的页里。例如,当一个新行需要600字节,但是当前页空闲空间只有500字节,那么,ASA会把这600字节的新行放到新的数据页里。

为了达到连续存储 的目的,ASA每次分配8个页面,称为一个块(block),如,当它需要一个新页时,它会一次性分配8个页面,把这8个页面放到一个块结构里。会使用一个空闲页位图来查找数据库表空间里头可用的连续页块,执行连续扫描,按组读取64KB,使用位图查找相关页面。这就比每次只读取单个页面要快得多。

2.ASA存储数据的顺序是任意的

ASA定位到具体的页号,插入数据的顺序是按照它接收时的顺序来的。它为每一个数据行找到一个具体的页,但是具体是哪一个页,并不一定严格按照接收时的顺序递增。e.g. 可能某一行太大,启动一个新页来存储,紧接着,一行比较小,可能会存储到以前有剩余空间的旧页里头,因而顺序并不严格一致。

表中的记录行并没有进行排序,要取得顺序结果,要依赖于order by子句,这与所有的RDBMS是一致的。

3. ASA不会为NULL空值列预留空间

缺省情况下,无论ASA何时插入一行,它只会保留插入时使用的那么大的空间。它不会预留更多的空间便于将来的更新。

改变此行为的唯一办法是在CREATE TABLE时使用PCTFREE子句.如果没有设定此值,将会采用默认值。该默认值存储到系统表:ISYSTAB里。

查看一个表的碎片程度,CALL sa_table_fragmentation( ) 会得到所有的表的情况。

4. 插入完成以后,行ID不会发生变化。

每一个数据行都有唯一的行ID,一旦插入完成,就不会发生变化。在更新的时候,如果数据行所在页没有足够的空闲空间,则会发生行链接,一个记录行会发生跨页存储,导致性能上的下降。

5. 数据库文件永远不会自动收缩

数据库会重用以前的空间,ASA会记录所有页的空闲空间,插入时,会搜索所有现存页的空闲空间记录,如果有足够的空间,即把记录插入到目标页,找不到时,会启动一个新页,完成插入操作。

在所有的数据库操作中,在执行了多次删除记录的操作,但是没有新的足够小的记录来重用这些删除操作后产生的新的空闲空间,这就是表碎片产生的一个重要原因,消除表碎片,可以提高扫描表记录的性能,使用语句:

REORGANIZE TABLE
即可达到目的。

对整个数据库的unload, reload则会重新整理整个数据库的碎片,也会有一次性能的提升。

重建过程如下:(引用IIHERO 版主)

请看下边的操作步骤:

1. 执行unload并reload, 新建一个数据库文件e:\default.db

E:\Sybase\UnwiredPlatform\Servers\SQLAnywhere12\BIN64>dbunload -c "uid=dba;pwd=sql;dbf=E:\Sybase\UnwiredPlatform\Data\CDB\default.db" -an e:\default.db

[sql] view plaincopyprint?

Unloading "DBA"."sup_pdcn"
Unloading "DBA"."sup_requestor"
Unloading "DBA"."d1_phx_1_0_asoheader_sk"
Unloaded 150 tables of 218
Unloading "DBA"."d1_phx_1_0_asoorderedpa_16449_sk"
Unloading "DBA"."d1_phx_1_0_asopartner_sk"
Unloading "DBA"."d1_phx_1_0_asoshippedpa_47173_sk"
Unloading "DBA"."d1_phx_1_0_asoshippedse_49199_sk"
Unloading "DBA"."d1_phx_1_0_businesspart_60140_sk"
Unloading "DBA"."d1_phx_1_0_contactperso_94681_sk"
Unloading "DBA"."d1_phx_1_0_customerfaci_60060_sk"
Unloading "DBA"."d1_phx_1_0_equipmentmas_48276_sk"
Unloading "DBA"."d1_phx_1_0_fse_sk"
Unloading "DBA"."d1_phx_1_0_fseassignmen_99497_sk"
Unloading "DBA"."d1_phx_1_0_historyorder_64376_sk"
Unloading "DBA"."d1_phx_1_0_historyswohe_23872_sk"
Unloading "DBA"."d1_phx_1_0_historyswoop_44172_sk"
Unloading "DBA"."d1_phx_1_0_historyusedp_83880_sk"
Unloading "DBA"."d1_phx_1_0_materialmast_53065_sk"
Unloading "DBA"."d1_phx_1_0_materialmast_65981_sk"
Unloading "DBA"."d1_phx_1_0_notification_53622_sk"
Unloading "DBA"."d1_phx_1_0_notification_96212_sk"
Unloading "DBA"."d1_phx_1_0_partsmovemen_19757_sk"
Unloading "DBA"."d1_phx_1_0_swocomponent_sk"
Unloading "DBA"."d1_phx_1_0_swooperation_sk"
Unloading "DBA"."d1_phx_1_0_timeconfirma_83198_sk"
Unloading "DBA"."d1_phx_1_0_swoheader_sk"
Unloading "DBA"."d1_phx_1_0_keygenerator"
Unloading "DBA"."d1_phx_1_0_packagebigpr_33993"
Unloading "DBA"."d1_phx_1_0_packageprope_74499"
Unloading "DBA"."d1_phx_1_0_operationrep_99182"
Unloading "DBA"."d1_phx_1_0_logrecordimp_21191"
Unloading "DBA"."d1_phx_1_0_fse_pull_pq"
Unloading "DBA"."d1_phx_1_0_fse"
Unloading "DBA"."d1_phx_1_0_customerfaci_60060"
Unloading "DBA"."d1_phx_1_0_materialmast_04961"
Unloading "DBA"."d1_phx_1_0_materialmast_61933"
Unloading "DBA"."d1_phx_1_0_materialmast_65981"
Unloading "DBA"."d1_phx_1_0_materialmast_53065"
Unloading "DBA"."d1_phx_1_0_fseassignmen_38789"
Unloading "DBA"."d1_phx_1_0_changelogimp_38232"
Unloading "DBA"."d1_phx_1_0_businesspart_60140"
Unloading "DBA"."d1_phx_1_0_contactperso_94681"
Unloading "DBA"."d1_phx_1_0_fseassignmen_99497"
Unloading "DBA"."d1_phx_1_0_swoheader"
Unloading "DBA"."d1_phx_1_0_swocomponent"
Unloading "DBA"."d1_phx_1_0_swooperation"
Unloading "DBA"."d1_phx_1_0_partsmovemen_19757"
Unloading "DBA"."d1_phx_1_0_notification_96212"
Unloading "DBA"."d1_phx_1_0_notification_53622"
Unloading "DBA"."d1_phx_1_0_equipmentmas_48276"
Unloading "DBA"."d1_phx_1_0_historyswohe_23872"
Unloading "DBA"."d1_phx_1_0_historyusedp_83880"
Unloading "DBA"."d1_phx_1_0_historyswoop_44172"
Unloaded 200 tables of 218
Unloading "DBA"."d1_phx_1_0_historyorder_64376"
Unloading "DBA"."d1_phx_1_0_asoheader"
Unloading "DBA"."d1_phx_1_0_asoorderedpa_16449"
Unloading "DBA"."d1_phx_1_0_timeconfirma_83198"
Unloading "DBA"."d1_phx_1_0_asopartner"
Unloading "DBA"."d1_phx_1_0_asoshippedpa_47173"
Unloading "DBA"."d1_phx_1_0_asoshippedse_49199"
Unloading "DBA"."D1_PHX_1_0__GRAPH_EXPIRATION"
Unloading "DBA"."D1_PHX_1_0__GRAPH"
Unloading "DBA"."D1_PHX_1_0__GRAPH_SK"
Unloading "DBA"."D1_PHX_1_0__CACHE_POLICY"
Unloading "DBA"."D1_PHX_1_0__CACHE_UPDATE"
Unloading "DBA"."D1_PHX_1_0__CACHE_STATE"
Unloading "DBA"."D1_PHX_1_0__PARTITION_REFRESH"
Unloading "DBA"."D1_PHX_1_0__PARTITION"
Unloading "DBA"."D1_PHX_1_0__SWOCACHEGROUP_CACHE_LOCK"
Unloading "DBA"."D1_PHX_1_0__CUSTDOCCACHEGROUP_CACHE_LOCK"
Unloading "DBA"."D1_PHX_1_0__MMGCACHEGROUP_CACHE_LOCK"
Creating indexes
Creating indexes for (1/224) "DBA"."ml_user"
Creating indexes for (2/224) "DBA"."ml_database"
Creating indexes for (3/224) "DBA"."ml_subscription"
Creating indexes for (4/224) "DBA"."ml_table"
Creating indexes for (5/224) "DBA"."ml_script"
Creating indexes for (6/224) "DBA"."ml_script_version"
Creating indexes for (7/224) "DBA"."ml_connection_script"
Creating indexes for (8/224) "DBA"."ml_table_script"
Creating indexes for (9/224) "DBA"."ml_property"
Creating indexes for (10/224) "DBA"."ml_scripts_modified"
Creating indexes for (11/224) "DBA"."ml_column"
Creating indexes for (12/224) "DBA"."ml_primary_server"
Creating indexes for (13/224) "DBA"."ml_passthrough_script"
Creating indexes for (14/224) "DBA"."ml_passthrough"
Creating indexes for (15/224) "DBA"."ml_passthrough_status"
Creating indexes for (16/224) "DBA"."ml_passthrough_repair"
Creating indexes for (17/224) "DBA"."ml_device"
Creating indexes for (18/224) "DBA"."ml_device_address"
Creating indexes for (19/224) "DBA"."ml_listening"
Creating indexes for (20/224) "DBA"."ml_sis_sync_state"
Creating indexes for (21/224) "DBA"."ml_qa_repository"
Creating indexes for (22/224) "DBA"."ml_qa_notifications"
Creating indexes for (23/224) "DBA"."ml_qa_delivery"
Creating indexes for (24/224) "DBA"."ml_qa_status_history"
Creating indexes for (25/224) "DBA"."ml_qa_clients"
Creating indexes for (26/224) "DBA"."ml_qa_repository_archive"
Creating indexes for (27/224) "DBA"."ml_qa_delivery_archive"
Creating indexes for (28/224) "DBA"."ml_qa_status_history_archive"
Creating indexes for (29/224) "DBA"."ml_qa_repository_props_archive"
Creating indexes for (30/224) "DBA"."ml_qa_global_props"
Creating indexes for (31/224) "DBA"."ml_qa_repository_props"
Creating indexes for (32/224) "DBA"."ml_qa_repository_staging"
Creating indexes for (33/224) "DBA"."ml_qa_status_staging"
Creating indexes for (34/224) "DBA"."ml_ra_agent"
Creating indexes for (35/224) "DBA"."ml_ra_task"
Creating indexes for (36/224) "DBA"."ml_ra_deployed_task"
Creating indexes for (37/224) "DBA"."ml_ra_task_command"
Creating indexes for (38/224) "DBA"."ml_ra_event"
Creating indexes for (39/224) "DBA"."ml_ra_event_staging"
Creating indexes for (40/224) "DBA"."ml_ra_notify"
Creating indexes for (41/224) "DBA"."ml_ra_task_property"
Creating indexes for (42/224) "DBA"."ml_ra_task_command_property"
Creating indexes for (43/224) "DBA"."ml_ra_managed_remote"
Creating indexes for (44/224) "DBA"."ml_ra_schema_name"
Creating indexes for (45/224) "DBA"."ml_ra_agent_property"
Creating indexes for (46/224) "DBA"."ml_ra_agent_staging"
Creating indexes for (47/224) "DBA"."mms_reg_users"
Creating indexes for (48/224) "DBA"."mms_devices_users_info"
Creating indexes for (49/224) "DBA"."mms_apps_users_info"
Creating indexes for (50/224) "DBA"."mms_domain_users_info"
Creating indexes for (51/224) "DBA"."mms_domain_devices_info"
Creating indexes for (52/224) "DBA"."mms_reg_users_lock"
Creating indexes for (53/224) "DBA"."mms_license_table_oper"
Creating indexes for (54/224) "DBA"."personalization_keys"
Creating indexes for (55/224) "DBA"."personalization_key_values"
Creating indexes for (56/224) "DBA"."mms_domain"
Creating indexes for (57/224) "DBA"."mms_administrators"
Creating indexes for (58/224) "DBA"."mms_domain_admin"
Creating indexes for (59/224) "DBA"."mms_domain_package"
Creating indexes for (60/224) "DBA"."mms_domain_security"
Creating indexes for (61/224) "DBA"."mms_licensed_device"
Creating indexes for (62/224) "DBA"."mms_application_info"
Creating indexes for (63/224) "DBA"."mms_application_package_info"
Creating indexes for (64/224) "DBA"."mms_application_domain_info"
Creating indexes for (65/224) "DBA"."mms_application_users_info"
Creating indexes for (66/224) "DBA"."mms_application_connection_info"
Creating indexes for (67/224) "DBA"."mms_metadata_container"
Creating indexes for (68/224) "DBA"."mms_assigned_widget_info"
Creating indexes for (69/224) "DBA"."mms_playback_history"
Creating indexes for (70/224) "DBA"."mms_domain_logging_configuration"
Creating indexes for (71/224) "DBA"."mms_domain_logging_filter"
Creating indexes for (72/224) "DBA"."sup_sis_subscription"
Creating indexes for (73/224) "DBA"."sup_sis_notification"
Creating indexes for (74/224) "DBA"."sup_sis_mbo_change_detection"
Creating indexes for (75/224) "DBA"."mms_rbs_subscription"
Creating indexes for (76/224) "DBA"."mms_upgrade_bookkeeping_info"
Creating indexes for (77/224) "DBA"."sup_ss"
Creating indexes for (78/224) "DBA"."#should_delete_sk"
Creating indexes for (79/224) "DBA"."#should_have_sk"
Creating indexes for (80/224) "DBA"."mms_lock"
Creating indexes for (81/224) "DBA"."sup_ps"
Creating indexes for (82/224) "DBA"."AMP_MODULES"
Creating indexes for (83/224) "DBA"."AMP_MODULE_VERSIONS"
Creating indexes for (84/224) "DBA"."AMP_CONTEXT_VARIABLES"
Creating indexes for (85/224) "DBA"."DEVICES"
Creating indexes for (86/224) "DBA"."AMP_DEVICE_MODULE_ASSIGNMENT"
Creating indexes for (87/224) "DBA"."AMP_ERRORS"
Creating indexes for (88/224) "DBA"."AMP_MATCH_RULES"
Creating indexes for (89/224) "DBA"."AMP_MODULE_DEPLOYMENT"
Creating indexes for (90/224) "DBA"."AMP_PROCESSED_IDS"
Creating indexes for (91/224) "DBA"."AMP_RESPONSE_QUEUE"
Creating indexes for (92/224) "DBA"."AMP_SERVER_PLUGINS"
Creating indexes for (93/224) "DBA"."AMP_TRANSFORM_QUEUE"
Creating indexes for (94/224) "DBA"."USERS"
Creating indexes for (95/224) "DBA"."USER_DEVICE"
Creating indexes for (96/224) "DBA"."DEVICE_CONNECTIONS"
Creating indexes for (97/224) "DBA"."AWAITING_CLIENTS"
Creating indexes for (98/224) "DBA"."CFG_TEMPLATES"
Creating indexes for (99/224) "DBA"."CFG_IDS"
Creating indexes for (100/224) "DBA"."CFG_PROP_VALIDATION"
Creating indexes for (101/224) "DBA"."CFG_PROP_DEFS"
Creating indexes for (102/224) "DBA"."CFG_PROP_VALUES"
Creating indexes for (103/224) "DBA"."CFG_SUBFOLDER_PROP_VALUES"
Creating indexes for (104/224) "DBA"."CFG_SYS_PROP_VALUES"
Creating indexes for (105/224) "DBA"."CFG_TRACE"
Creating indexes for (106/224) "DBA"."CFG_TRACE_VERSION"
Creating indexes for (107/224) "DBA"."EXCH_MAILBOX_INFO"
Creating indexes for (108/224) "DBA"."EXCH_FOLDER_INFO"
Creating indexes for (109/224) "DBA"."EXCH_IMO_RECORD_WRITES"
Creating indexes for (110/224) "DBA"."EXCH_RECORD_QUEUE"
Creating indexes for (111/224) "DBA"."FT_CAB_VERSIONS"
Creating indexes for (112/224) "DBA"."IMAP_IDS"
Creating indexes for (113/224) "DBA"."IMP_CONFIG"
Creating indexes for (114/224) "DBA"."IMP_CONFIG_RULE"
Creating indexes for (115/224) "DBA"."IMP_PROCESSED_EMAILS"
Creating indexes for (116/224) "DBA"."INJECTION_OUTBOX"
Creating indexes for (117/224) "DBA"."IPHONE_PUSH_COUNT"
Creating indexes for (118/224) "DBA"."LB_NODES"
Creating indexes for (119/224) "DBA"."LOCK_USER_DEVICE"
Creating indexes for (120/224) "DBA"."MOMS_ROLE"
Creating indexes for (121/224) "DBA"."MOMS_DEVICE_ROLE"
Creating indexes for (122/224) "DBA"."MOMS_FUNCTIONAL_AREA"
Creating indexes for (123/224) "DBA"."MOMS_FUNCTIONAL_AREA_METHOD"
Creating indexes for (124/224) "DBA"."MOMS_ROLE_FUNCTIONAL_AREA"
Creating indexes for (125/224) "DBA"."QUEUED_MESSAGES"
Creating indexes for (126/224) "DBA"."MO_BINARY_STREAM"
Creating indexes for (127/224) "DBA"."MO_BINARY_STREAM_DATA"
Creating indexes for (128/224) "DBA"."MO_D2S_STREAM_DATA"
Creating indexes for (129/224) "DBA"."NL_USER_DS"
Creating indexes for (130/224) "DBA"."NOTES_LB_SYNC"
Creating indexes for (131/224) "DBA"."NOTIFICATION_BATCHING"
Creating indexes for (132/224) "DBA"."NOTIFICATION_QUEUE"
Creating indexes for (133/224) "DBA"."ONLINE_HISTORY"
Creating indexes for (134/224) "DBA"."POP_IDS"
Creating indexes for (135/224) "DBA"."PUBLISHED_CLIENTS"
Creating indexes for (136/224) "DBA"."STORED_RESPONSES"
Creating indexes for (137/224) "DBA"."SYNCHRONOUS_RESPONSES"
Creating indexes for (138/224) "DBA"."SYNC_ID_MAP"
Creating indexes for (139/224) "DBA"."SYNC_REPEAT_INFO"
Creating indexes for (140/224) "DBA"."SYNC_REPEAT_INSTANCE"
Creating indexes for (141/224) "DBA"."SYNC_REQUESTS"
Creating indexes for (142/224) "DBA"."TEST_DBLAYER"
Creating indexes for (143/224) "DBA"."TM_RESPONSE_CONTINUATION"
Creating indexes for (144/224) "DBA"."UPG_CURRENT_DB_VERSION"
Creating indexes for (145/224) "DBA"."USER_DEVICE_STATUS"
Creating indexes for (146/224) "DBA"."AMP_TEMPLATE_MODULE"
Creating indexes for (147/224) "DBA"."AMP_METADATA"
Creating indexes for (148/224) "DBA"."jms_qt"
Creating indexes for (149/224) "DBA"."jms_pm"
Creating indexes for (150/224) "DBA"."jms_dd"
Creating indexes for (151/224) "DBA"."sup_pdcn"
Creating indexes for (152/224) "DBA"."#should_have_parent_sk"
Creating indexes for (153/224) "DBA"."sup_requestor"
Creating indexes for (154/224) "DBA"."d1_phx_1_0_asoheader_sk"
Creating indexes for (155/224) "DBA"."d1_phx_1_0_asoorderedpa_16449_sk"
Creating indexes for (156/224) "DBA"."d1_phx_1_0_asopartner_sk"
Creating indexes for (157/224) "DBA"."d1_phx_1_0_asoshippedpa_47173_sk"
Creating indexes for (158/224) "DBA"."d1_phx_1_0_asoshippedse_49199_sk"
Creating indexes for (159/224) "DBA"."d1_phx_1_0_businesspart_60140_sk"
Creating indexes for (160/224) "DBA"."d1_phx_1_0_contactperso_94681_sk"
Creating indexes for (161/224) "DBA"."d1_phx_1_0_customerfaci_60060_sk"
Creating indexes for (162/224) "DBA"."d1_phx_1_0_equipmentmas_48276_sk"
Creating indexes for (163/224) "DBA"."d1_phx_1_0_fse_sk"
Creating indexes for (164/224) "DBA"."d1_phx_1_0_fseassignmen_99497_sk"
Creating indexes for (165/224) "DBA"."d1_phx_1_0_historyorder_64376_sk"
Creating indexes for (166/224) "DBA"."d1_phx_1_0_historyswohe_23872_sk"
Creating indexes for (167/224) "DBA"."d1_phx_1_0_historyswoop_44172_sk"
Creating indexes for (168/224) "DBA"."d1_phx_1_0_historyusedp_83880_sk"
Creating indexes for (169/224) "DBA"."d1_phx_1_0_materialmast_53065_sk"
Creating indexes for (170/224) "DBA"."d1_phx_1_0_materialmast_65981_sk"
Creating indexes for (171/224) "DBA"."d1_phx_1_0_notification_53622_sk"
Creating indexes for (172/224) "DBA"."d1_phx_1_0_notification_96212_sk"
Creating indexes for (173/224) "DBA"."d1_phx_1_0_partsmovemen_19757_sk"
Creating indexes for (174/224) "DBA"."d1_phx_1_0_swocomponent_sk"
Creating indexes for (175/224) "DBA"."d1_phx_1_0_swooperation_sk"
Creating indexes for (176/224) "DBA"."d1_phx_1_0_timeconfirma_83198_sk"
Creating indexes for (177/224) "DBA"."d1_phx_1_0_swoheader_sk"
Creating indexes for (178/224) "DBA"."d1_phx_1_0_keygenerator"
Creating indexes for (179/224) "DBA"."d1_phx_1_0_packagebigpr_33993"
Creating indexes for (180/224) "DBA"."d1_phx_1_0_packageprope_74499"
Creating indexes for (181/224) "DBA"."d1_phx_1_0_operationrep_99182"
Creating indexes for (182/224) "DBA"."d1_phx_1_0_logrecordimp_21191"
Creating indexes for (183/224) "DBA"."d1_phx_1_0_fse_pull_pq"
Creating indexes for (184/224) "DBA"."d1_phx_1_0_fse"
Creating indexes for (185/224) "DBA"."d1_phx_1_0_customerfaci_60060"
Creating indexes for (186/224) "DBA"."d1_phx_1_0_materialmast_04961"
Creating indexes for (187/224) "DBA"."d1_phx_1_0_materialmast_61933"
Creating indexes for (188/224) "DBA"."d1_phx_1_0_materialmast_65981"
Creating indexes for (189/224) "DBA"."d1_phx_1_0_materialmast_53065"
Creating indexes for (190/224) "DBA"."d1_phx_1_0_fseassignmen_38789"
Creating indexes for (191/224) "DBA"."d1_phx_1_0_changelogimp_38232"
Creating indexes for (192/224) "DBA"."d1_phx_1_0_businesspart_60140"
Creating indexes for (193/224) "DBA"."d1_phx_1_0_contactperso_94681"
Creating indexes for (194/224) "DBA"."d1_phx_1_0_fseassignmen_99497"
Creating indexes for (195/224) "DBA"."d1_phx_1_0_swoheader"
Creating indexes for (196/224) "DBA"."d1_phx_1_0_swocomponent"
Creating indexes for (197/224) "DBA"."d1_phx_1_0_swooperation"
Creating indexes for (198/224) "DBA"."d1_phx_1_0_partsmovemen_19757"
Creating indexes for (199/224) "DBA"."d1_phx_1_0_notification_96212"
Creating indexes for (200/224) "DBA"."d1_phx_1_0_notification_53622"
Creating indexes for (201/224) "DBA"."d1_phx_1_0_equipmentmas_48276"
Creating indexes for (202/224) "DBA"."d1_phx_1_0_historyswohe_23872"
Creating indexes for (203/224) "DBA"."d1_phx_1_0_historyusedp_83880"
Creating indexes for (204/224) "DBA"."d1_phx_1_0_historyswoop_44172"
Creating indexes for (205/224) "DBA"."d1_phx_1_0_historyorder_64376"
Creating indexes for (206/224) "DBA"."d1_phx_1_0_asoheader"
Creating indexes for (207/224) "DBA"."d1_phx_1_0_asoorderedpa_16449"
Creating indexes for (208/224) "DBA"."d1_phx_1_0_timeconfirma_83198"
Creating indexes for (209/224) "DBA"."d1_phx_1_0_asopartner"
Creating indexes for (210/224) "DBA"."d1_phx_1_0_asoshippedpa_47173"
Creating indexes for (211/224) "DBA"."d1_phx_1_0_asoshippedse_49199"
Creating indexes for (212/224) "DBA"."D1_PHX_1_0__GRAPH_EXPIRATION"
Creating indexes for (213/224) "DBA"."D1_PHX_1_0__GRAPH"
Creating indexes for (214/224) "DBA"."D1_PHX_1_0__GRAPH_LOCK"
Creating indexes for (215/224) "DBA"."D1_PHX_1_0__GRAPH_SK"
Creating indexes for (216/224) "DBA"."D1_PHX_1_0__CACHE_POLICY"
Creating indexes for (217/224) "DBA"."D1_PHX_1_0__CACHE_UPDATE"
Creating indexes for (218/224) "DBA"."D1_PHX_1_0__CACHE_STATE"
Creating indexes for (219/224) "DBA"."D1_PHX_1_0__PARTITION_REFRESH"
Creating indexes for (220/224) "DBA"."D1_PHX_1_0__PARTITION_LOCK"
Creating indexes for (221/224) "DBA"."D1_PHX_1_0__PARTITION"
Creating indexes for (222/224) "DBA"."D1_PHX_1_0__SWOCACHEGROUP_CACHE_LOCK"
Creating indexes for (223/224) "DBA"."D1_PHX_1_0__CUSTDOCCACHEGROUP_CACHE_LOCK"
Creating indexes for (224/224) "DBA"."D1_PHX_1_0__MMGCACHEGROUP_CACHE_LOCK"

2. 重新指定log位置,(因为原来的log就在 d:\DbTxLogs\default.log下边),而unload/reload操作只会把log文件放到db的当前目录下边

E:\Sybase\UnwiredPlatform\Servers\SQLAnywhere12\BIN64>dblog -t d:\DbTxLogs\default.log e:\default.db

SQL Anywhere Transaction Log Utility Version 12.0.1.3769

"e:\default.db" was using log file "default.log"

"e:\default.db" is using no log mirror file

"e:\default.db" is now using log file "d:\DbTxLogs\default.log"

Transaction log starting offset is 0000548524

Transaction log current relative offset is 0002443703

3. copy default.db and default.log to the original location.恢复到原来位置

4. 看看对应的文件的大小:

E:\Sybase\UnwiredPlatform\Servers\SQLAnywhere12\BIN64>dir E:\Sybase\UnwiredPlatf

orm\Data\CDB\default.*

Volume in drive E is Local Disk

Volume Serial Number is FE06-8788

Directory of E:\Sybase\UnwiredPlatform\Data\CDB

01/15/2013 11:10 PM 79,192,064 default.db (新生成的)

01/15/2013 11:02 PM 6,684,798,976 default.db.old (老的)

2 File(s) 6,763,991,040 bytes

0 Dir(s) 91,734,462,464 bytes free

E:\Sybase\UnwiredPlatform\Servers\SQLAnywhere12\BIN64>dir D:\DbTxLogs\default.*

Volume in drive D is Local Disk

Volume Serial Number is E2FD-6D0E

Directory of D:\DbTxLogs

01/15/2013 11:10 PM 4,456,448 default.log (新生成的)

01/15/2013 11:02 PM 145,142,382,592 default.log.old (老的)

2 File(s) 145,146,839,040 bytes

0 Dir(s) 1,814,528 bytes free

对于生产环境,除了定期备份,定期进行unload/reload也是很有意义的。ASA其实也可以用于中等规模的系统应用当中。操作非常方便。在移动应用中更是大显身手。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: