Drop and recreate Sybase ASE Database

At times it might be necessary to drop and recreate a Sybase ASE database. For example when you want to do a system copy from scratch and you need the current database to be cleaned up or when your DB is in inconsistent state and you want to created new DB and restore it.

Following command can be used to drop a database:

use master

go

drop database <dbname>

But if the DB is in inconsistent state you might get below error:

aseerror2

In such case use the below steps to drop the DB and create it again:

Note: DBCC DROPDB will only work if the database is marked as suspect:

First check if the DB is marked as suspect:

susp

If the DB is not marked as suspect, this should be marked explicitly:

  1. Allow updatesallupNote: At this stage you need to restart your database services for the changes to take effect.
  2. Set the status of DB to suspect (320)setstat
  3. Drop database using DBCC:dropdb

4.   Dont forget to disable the updates by setting “Allow Updates” to Zero and restart       the  database.

Advertisements

Stop Sybase ASE – Linux

If you want to shutdown backup server also, make sure too shut it down first, as you will not be able to login to isql if you shutdown main server first.

Login to isql to shudown the ASE database and issue command “shutdown”

shutdownbak

Then you can shutdown the ASE database instance.

shutdown

You can opt to kill the processes (For example: If you dont have password to login to isql). But this is not the most safer way. Please use this option only if you are not able to login to isql.

killase

Dont use -9 option. This might not allow uncommited DB transactions to rool back in a proper way.

 

Starting Sybase ASE Database (Linux)

Make sure you are logged in with user syb<sid>.

From the environment variables find you Sybase ASE install Directory:

path

Travesrse to the install path:

change dir

Here you see the configuration files (Runserver) RUN_<SID> (Database server) and RUN_<SID>_BS (Backup server).

Use command startserver to start each server process.

You can either start them individually or together.

  • -f runserverfile – specifies the relative path name of a runserver file, which is used as a reference each time you start an SAP ASE server or Backup Server. By default, the runserver file is in the current directory and is named RUN_servername. If you start a second SAP ASE server on the same machine, startserver creates a new runserver file named RUN_servername.
  • -m – starts an SAP ASE server in single-user mode, allowing only one system administrator to log in, and turns the allow updates to system tables configuration parameter on. Use this mode to restore the master database. The system administrator can use thedbo use only parameter of sp_dboption for system administration activities that require more than one process, such as bulk copying or using the data dictionary. startserver normally starts up only one server per node.The -m parameter creates an m_RUNSERVER file and overwrites any existing m_RUNSERVER file.

start

After both the processes are started the control is not returned back until you hit a key.

end of start

Now you can check the status of server using command showserver.

showserver

 

2570084 – How to start Backup Server manually – SAP ASE

2307016 – How to manually configure and start ASE Cockpit for an existing ASE server – ASE 16.0 SP02 PL02

2581558 – Starting SAP ASE Backup Server as windows service reporting error “The service did not respond to the start or control request in a timely fashion”support-grace , support grace, Application version, License version, lic, Sysam, grace period, ASEServer, SAPASE, .lic, FLEXnet Licensing error, key, old license file, datestamp, support renewal date, sybase license , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , Problem

How to analyze saptools database growth in Sybase ASE database and contain it

SAPTOOLS database mainly contains the monitoring data for Sybase ASE database.

You can decide the duration this data can be retained by configuring the collector parameters in DBACOCKPIT.

saptools1

Ensure that the message level is set to error. If not this may significantly increase the growth of this database.

If the history of monitoring is not required anymore, you can also delete the data and log using the prune option.

SQL0204N

The retention policy can be set individually by selecting each data collector and changing the “Days Kept In History” parameter.

ase3

Below are some SAP Notes related to SAPTOOLS database:

2100175 – SYB: Increased space allocation of data collectors ‘Tables’ and ‘Indexes’

1927012 – DBA Cockpit shows warnings “Required data collector xxx is not set up properly” – SAP ASE for Business Suite

1615695 – SYB: ‘saptools’ database running out of space

1687320 – SYB: ‘saptools’ database running out of space (2)

2006899 – How to configure reorg on saptools database in DBA Cockpit – SAP ASE for Business Suite

2497314 – How to recreate database saptools when it is corrupted and no clear backup – SAP ASE for Business Suite

2381666 – How to enlarge saptools database through DBA Cockpit – SAP ASE for Business Suite