系统管理指南:基本管理

Procedure如何修复已损坏的系统信息库

以下过程显示如何将已损坏的系统信息库替换为缺省的系统信息库副本。系统信息库守护进程 svc.configd 在启动之后不会对配置系统信息库执行完整性检查。配置系统信息库存储在 /etc/svc/repository.db 中。配置系统信息库可能会由于以下某种原因而损坏:

如果完整性检查失败,svc.configd 守护进程会向控制台写入一条以下类似的消息:


svc.configd: smf(5) database integrity check of:

    /etc/svc/repository.db

  failed.  The database might be damaged or a media error might have
  prevented it from being verified.  Additional information useful to
  your service provider is in:

    /etc/svc/volatile/db_errors

  The system will not be able to boot until you have restored a working
  database.  svc.startd(1M) will provide a sulogin(1M) prompt for recovery
  purposes.  The command:

    /lib/svc/bin/restore_repository

  can be run to restore a backup version of your repository. See
  http://sun.com/msg/SMF-8000-MY for more information.

随后,svc.startd 守护进程将退出,并启动 sulogin,以便您进行维护。

  1. sulogin 提示符下输入 root 口令。借助 suloginroot 用户可以进入系统维护模式从而修复系统。

  2. 运行以下命令:


    # /lib/svc/bin/restore_repository
    

    运行此命令可指导您完成恢复未经损坏的备份所必需的步骤。SMF 会在系统的任何关键时刻自动提取系统信息库的备份。有关更多信息,请参见SMF 系统信息库备份

    在启动 /lib/svc/bin/restore_repository 命令之后,会显示一条以下类似的消息:


    Repository Restore utility
    See http://sun.com/msg/SMF-8000-MY for more information on the use of
    this script to restore backup copies of the smf(5) repository.
    
    If there are any problems which need human intervention, this script
    will give instructions and then exit back to your shell.
    
    Note that upon full completion of this script, the system will be
    rebooted using reboot(1M), which will interrupt any active services.

    如果要恢复的系统不是本地区域,则该脚本将说明如何使用读取和写入权限来重新挂载 //usr 文件系统,以便恢复数据库。该脚本会在列显这些说明之后退出。请按照这些说明执行操作,同时应特别注意可能出现的任何错误。

    在使用写入权限挂载了 root ( /) 文件系统之后,或者如果该系统是本地区域,则系统将提示您选择要恢复的系统信息库备份:


    The following backups of /etc/svc/repository.db exists, from
    oldest to newest:
    
    ... list of backups ...

    基于备份类型和备份时间来确定备份的名称。以 boot 开头的备份在系统引导之后、首次更改系统信息库之前完成。以 manifest_import 开头的备份在 svc:/system/manifest-import:default 完成其进程之后完成。备份时间以 YYYYMMDD_HHMMSS 格式提供。

  3. 输入相应的响应。

    通常会选择最新的备份选项。

    Please enter one of:
            1) boot, for the most recent post-boot backup
            2) manifest_import, for the most recent manifest_import backup.
            3) a specific backup repository from the above list
            4) -seed-, the initial starting repository. (All customizations
               will be lost.)
            5) -quit-, to cancel.
    
    Enter response [boot]:

    如果在未指定要恢复的备份的情况下按 Enter 键,则会选择用 [] 括起的缺省响应。选择 -quit- 会退出 restore_repository 脚本,并返回到 shell 提示符。


    注 –

    选择 -seed- 会恢复 seed 系统信息库。此系统信息库设计用于初始安装和升级过程。如非绝对必要,请勿使用 seed 系统信息库进行恢复。


    在选择了要恢复的备份之后,系统将对其进行验证并检查其完整性。如有任何问题,restore_repository 命令会列显错误消息并提示您进行其他选择。在选择了有效的备份之后,系统会列显如下信息,并提示您进行最终确认。

    After confirmation, the following steps will be taken:
    
    svc.startd(1M) and svc.configd(1M) will be quiesced, if running.
    /etc/svc/repository.db
        -- renamed --> /etc/svc/repository.db_old_YYYYMMDD_HHMMSS
    /etc/svc/volatile/db_errors
        -- copied --> /etc/svc/repository.db_old_YYYYMMDD_HHMMSS_errors
    repository_to_restore
        -- copied --> /etc/svc/repository.db
    and the system will be rebooted with reboot(1M).
    
    Proceed [yes/no]?
  4. 键入 yes 修复故障。

    restore_repository 命令执行了列出的所有操作之后,系统将重新引导。