生产环境的数据表修改乱了,需要从备份中还原,将备份文件拷贝到测试机上,使用HANA Studio执行还原租户库。
一会儿回来,看到进度条都已经完成,颇感欣慰,关闭窗口用HANA Studio连接数据库,可是就是连接不上,连接SYSTEM库没有问题。
xshell登录HANA数据库服务器的操作系统
s4padm@ip:/hana/hanabackup> hdbsql -i 0 -u SYSTEM -p password -d SYSTEMDB
Welcome to the SAP HANA Database interactive terminal.
Type: \h for help with commands
\q to quit
hdbsql SYSTEMDB=> select * from m_databases --看看租户库的状态
hdbsql SYSTEMDB=> alter system start database S4P -启动租户库
* 2: general error: Database could not be started;startDatabase() failed: previous recovery incomplete: volume: 3:2 is in state: RecoveryError volume: 3:3 is in state: RecoveryError volume: 3:4 is in state: RecoveryError volume: 3:5 is in state: RecoveryError SQLSTATE: HY000
提示还原的数据不完全。
好像看不出具体原因。进入操作系统查看日志:
s4padm@ip:/usr/sap/S4P/HDB00/ip*/trace> more nameserver_alert_ip*.trc
[10064]{100158}[26/-1] 2021-04-24 11:29:51.108159 e NameServer TREXNameServer.cpp(09081) : TREXNameServer::startDatabase: 3 failed : previous recovery incomplete: volum
e: 3:2 is in state: RecoveryError volume: 3:3 is in state: RecoveryError volume: 3:4 is in state: RecoveryError volume: 3:5 is in state: RecoveryError[10064]{100158}[26/-1] 2021-04-24 11:29:51.108170 e tns_ddl TNSClient.cpp(00956) : start database '3' failed:Database could not be started;startDatabase() failed: previous recovery incomplete: volume: 3:2 is in state: RecoveryError volume: 3:3 is in state: RecoveryError volume: 3:4 is in state: RecoveryError volume: 3:5 is in state: Reco
veryError(5709)
还是提示错误,看来还是还原不成功导致的,那就重新还原一次,这次还原后成功了。
DATABASE_NAME,DESCRIPTION,ACTIVE_STATUS,ACTIVE_STATUS_DETAILS,OS_USER,OS_GROUP,RESTART_MODE,FALLBACK_SNAPSHOT_CREATE_TIME
"SYSTEMDB","SystemDB-S4P-00","YES","","","","DEFAULT",?
"S4P","","YES","","","","DEFAULT",?
在次还原也发现第一次失败的原因了,原来还原那个进度条不代表完成,要等还原完成的提示窗口蹦出来才是。其实我第一次关闭了窗口就算是终止了还原操作。