分类: Sybase
2006-08-18 00:08:45
If you forgot your sa password, you can recovery it by using dataserver utility's -psa option.
another important scenario recovery will make sense is in today's very popular storage snapshot. you can take snapshot of production host, then mount the snapshot to a tertiary host, now you can do any work you like on the snapshot host, without snapshot, you should do heavy duty work only in night.
but database administrator is often not reluctant to tell you the sa password, in this case, you can get a new-generated password by -psa option, now you can full control your ASE.
please notice sybase will not store the new password in error log file. so you must get it from the stdin mixed with stderr.
below is how to do it:
first add -psa to your RUN_SERVER file
below is a sample file:
#!/bin/sh
#
# ASE page size (KB): 2048
# Master device path: /dev/rlv_master5
# Error log path: /sybase5/ASE-12_5/install/SNAPSHOT.log
# Configuration file path: /sybase5/ASE-12_5/SNAPSHOT.cfg
# Directory for shared memory files: /sybase5/ASE-12_5
# Adaptive Server name: SNAPSHOT
#
/sybase5/ASE-12_5/bin/dataserver \
-d/dev/rlv_master5 \
-e/sybase5/ASE-12_5/install/SNAPSHOT.log \
-c/sybase5/ASE-12_5/SNAPSHOT.cfg \
-M/sybase5/ASE-12_5 \
-sSNAPSHOT \
-psa \
then start sybase ASE:
su - $SYBASEUSER -c "cd ASE-12_5/install;startserver -f RUN_SNAPSHOT > $TMPSTARTLOG 2>&1"
# please wait until ASE is fully started
......
# The line include new generated sa password looks like below:
# New SSO password for sa: ************
SAPASSWORD=`grep "New SSO password for sa" $TMPSTARTLOG|awk -F: '{print $NF}'`