Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run a script on sybase server startup

Status
Not open for further replies.

gj2007

IS-IT--Management
Apr 14, 2003
2
AU
Hello
I want to create the user defined data types in the tempdb as it is used by the temporary table.

Is it possible to run a sql script on the sybase sever start up so that the user defined types is created when the sybase sever is started....

 
There are two ways of doing this.

1) Add user defined datatypes to the "model" database. They will be auomatically loaded into tempdb when tempdb is created after startup.

2) Modify the Sybase RUN_SERVER fiile like below add your sql script at the end just after Sybase startup:

Code:
sybase@linux:/apps/sybase/sqlserver/1250/ASE-12_5/install% more RUN_lon_gen_sql_tst1
#!/bin/ksh
#
###
### Setup the environment variables
###
. ${HOME}/lon_gen_sql_tst1/dba/bin/environment.ksh
#
## Move the current errorlog and save it
#
NOW="`date +%d_%b_%Y_%H:%M`"
OLDLOG="${LOGDIR}/${DSQUERY}.log_${NOW}"
mv ${ERRORLOG} ${OLDLOG}
gzip ${OLDLOG}
#
# Adaptive Server name: lon_gen_sql_tst1
# ASE page size (KB):   2k
# Master device path:   /data1/lon_gen_sql_tst1/master.dat
# Error log path:       /apps/sybase/sqlserver/1250/ASE-12_5/install/lon_gen_sql_tst1.log
# Configuration file path:      /apps/sybase/sqlserver/1250/ASE-12_5/lon_gen_sql_tst1.cfg
# Directory for shared memory files:    /apps/sybase/sqlserver/1250/ASE-12_5
#
/apps/sybase/sqlserver/1250/ASE-12_5/bin/dataserver -slon_gen_sql_tst1 -d/data1/lon_gen_sql_tst1/master.dat -e/apps/sybase/sqlserver/1250/ASE-12_5/install/lon_gen_sql_tst1.log -M/apps/sybase/sqlserver/1250/ASE-12_5 -c/apps/sybase/sqlserver/1250/ASE-12_5/lon_gen_sql_tst1.cfg -i/apps/sybase/sqlserver/1250 -T243

#
### wait for 2 minute to make sure that tempdb brought
### online OK. You need to check this from sybase errorlog
### to put meaningful wait time
#
sleep 120
#
### put your isql or scrip here
#
isql -Usa -Slon_gen_sql_tst1 -Pabc < ./tempdb_datatypes.sql > /apps/sybase/sqlserver/1250/ASE-12_5/install/lon_gen_sql_tst1.log
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top