Author Archives: tore
Sybase ASE upgrade process
Upgrading Rep server to REP15.0.2
Upgrade the RSSD database, start with the ID server.
- Install the new software for replication server version 15 on your system. Put it in a new directory e.g /progs/torigodb/syb_rs15. After gunzipping and untarring the rep server tar ball run ./setup –console:
- You can then install any required Sybase patches, e.g ESD1
- Generate a license key (through sybase.subscribenet.com) and store it in the SYSAM-2_0/licences directory.
- Copy any custom scripts over from the old repserver, e.g .cshrc, repscripts etc, and modify as necessary, i.e change SYBASE path etc.
- Run “rs_helpsub” from the rssd database to verify that all subscriptions are valid. The status only needs to be Valid at the replicate replication server.
- Copy the interfaces file (or interfaces) from the pre version 15 to the version 15 installation.
- Log on the RSSD ASE server and grant the primary user the sa_role “grant role sa_role to <username>” if it doesn’t already have it. You can determine the name of the primary user by looking into the configuration file, at the keyword RSSD_primary_user.
- Log on to the replication server and run “admin health” to see if everything is ok.
- Shutdown the replication server, backup the RSSD database then restart the replication server.
- Leave repserver running.
- Set the environment variable $SYBASE to the new REP15 installation directory
- Set the environment variable SYBASE_REP to REP-15_0
- Start $SYBASE/$SYBASE_REP/install/rs_init (rs_init)
- Select “Configure a Server product” -> “Replication server” -> “Upgrade an existing replication server”.
- Answer all the questions. The configuration file should be the path and filename of the old config file.
- Do Ctrl-A to start.
After a succesfull upgrade
- Repoint the replication server paths to the new installation and copy the old runserver file to it’s new location. Make sure to change the paths in the runserver file to pick up the new version 15 executable and correct config files etc. Also copy over the old config file.
- Fix or copy any other files bespoke files, You need to update the file $SYBASE/config/objectid.dat file and add a line similar to
Installing Heterogeneous Replication
How to add/update a table for replication
How to add/update a table for replication
– First you need to create two scripts one to drop the existing subscription and replication definition and one to create the new table, replication definition and subscription. – You also need to extract the exiting replicant table and also a user, e.g. origomw, if requested and save this info. – Before stopping replication send an email to operations to let them know of the planned downtime. – At this point you should suspend the replication server connection from DB2, if it’s not already down and wait 5 minutes to make sure everything is applied. – Do a select count(*) against an existing replicant table and compare this with a wc –l of the bcp file to make sure they match in number. For a new table this is not relevant. – Bcp out the existing table just in case something goes wrong. – Drop a user if that was requested – Drop subscription, rep def in rep server: o drop subscription DB2_ASN2_RESOURCE_NB_s2 for DB2_ASN2_RESOURCE_NB_d2 o with replicate at origo_test.deFaktoReplica o without purge o go o o drop replication definition “DB2_ASN2_RESOURCE_NB_d2″ o go – Drop the table in ASE o Use database deFaktoReplica o Go o Drop table ASN2_RESOURCE_NB o Go – Create the table again – Bcp the data in with a command like: o bcp deFaktoReplica.dbo.ASN2_RESOURCE_NB in /home/origo/deFaktoReplica/init/data/SYS3.ASN2.DDX -r ” \n” -t “\t” -c -Jiso_1 -Sorigo_test –Usa –P<password> -e bcplog.txt -z -b 10000 -m 100000 o If you get problems check that the number of columns etc match and also check to see whether the row/tab delimiter is correct, sometimes there is an extra tab in the row delimiter, in that case try using –r “\t \n”. – Add the primary key, triggers and other indexes etc into the table, and possibly also a rep server specific column like changed_date. – Add the origomw user to the database. – Add the replication definition and subscription. o create replication definition “DB2_ASN2_RESOURCE_NB_d2” o with primary at TSTA.P825RAD1 o with primary table named “DB2_ASN2_RESOURCE_NB” o with replicate table named “ASN2_RESOURCE_NB” o ( o “RESR_ELMT_ID” int, o “RECORD_EFF_END_DT” datetime, o “RECORD_EFF_END_TM” datetime, o “RECORD_EFF_STR_DT” datetime, o “RECORD_EFF_STR_TM” datetime, o “SRVC_LOC_ID” numeric, o “RESR_TYPE” char(6), o “RESR_ID” char(22), o “ACCT_ID” numeric, o “RESR_EFF_STR_DT” datetime, o “RESR_EFF_END_DT” datetime, o “ORD_ITEM_ID” numeric, o “FST_USG_DT” datetime, o “REINSTATE_CD” char(4), o “REINSTALL_DT” datetime, o “DISCN_CD” char(4), o “ASN_RESR_DISCN_DT” datetime, o “VERBAL_TRANSLATION” char(20), o “COMMENT_ID” numeric, o “REF_SEQ_NUM” numeric, o “INIT_INSTALL_DT” datetime, o “LAST_CHANGE_DT” datetime, o “RESR_GRP_TYP” char(6), o “ORD_ITEM_SEQ” smallint, o “PRIORITY_CD” char(1), o “SUB_STATUS_CD” char(2), o “PRMRY_COMP_CD” char(6), o “SECNDRY_COMP_CD” char(6), o “NUFS_NET_SRVC_TYP” char(3), o “NUFS_NUM_CAT” char(2), o “USER_ID” char(8), o “PREV_PHONE_NUM” char(8), o “RSU” char(6), o “PRMRY_GRP” smallint, o “FSL” char(6), o “CALL_INTERCEPT” char(1), o “RESR_SUB_GRP” char(1), o “OWNER_ACCT_ID” numeric, o “OWNER_SRVC_LOC_ID” numeric, o “PAYER_REF” char(30), o “PAYER_KURT_ID” int, o “CREATORS_REFERENCE” char(25), o “UPDT_LAST_MOD_TS” datetime o ) o primary key o ( o “RESR_ELMT_ID”, o “RECORD_EFF_END_DT”, o “RECORD_EFF_END_TM” o ) o searchable columns (RECORD_EFF_END_DT) o go o o o define subscription DB2_ASN2_RESOURCE_NB_s2 o for DB2_ASN2_RESOURCE_NB_d2 o with replicate at origo_test.deFaktoReplica o where RECORD_EFF_END_DT = ’31 dec 9999′ o go – Activate the subscription with: o activate subscription DB2_ASN2_RESOURCE_NB_s2 o for DB2_ASN2_RESOURCE_NB_d2 o with replicate at origo_test.deFaktoReplica o go – Validate subscription with: o validate subscription DB2_ASN2_RESOURCE_NB_s2 o for DB2_ASN2_RESOURCE_NB_d2 o with replicate at origo_test.deFaktoReplica o go – Resume replication and ask DB2 admin to start the Repagent on their side.Installing RepServer 15
Installing RepServer 15
– Untar the repserver installation files into a seperate directory and install the binaries etc by running setup –console. Answer no to email alerts and don’t enter license information. – If you are migrating from an earlier version of Repserver and you have already migrated the ASE server then you need to make sure that the rep server logins are not expired, (e.g REP_dhtsolo_RSSD_prim and REP_dhtsolo_RSSD_maint). If they are expired, just try to login to the ase with them, you will need to change the passwords twice, first to a temp password and then back to the original. – If you are using Norwegian language then you will also need to add the nocase_iso_1_nor.srt file into $SYBASE/charsets/iso_1 and tweak the $SYBASE/config/objectid.dat file by adding the following or similar line at the bottom of the collate section: o 1.3.6.1.4.1.897.4.9.3.148 = nocase_iso_1_nor Find the final number 148 by doing an sp_helpsort in the ase server and looking for the number associated with nocase_iso_1_nor – Follow the regular steps for installing a repserver, i.e rs_init which should be fairly straight forward. When configuring the new rep server set the sort order to nocase_iso_1_norInstalling a Sybase ASE15 Server
How to drop a database when drop database fails
How to Drop a Database When drop database Fails
Follow the steps in this section to drop a database when drop database fails. Do not use these steps unless directed to do so by this book, or unless there is no critical data in the database.
1.Log in as the “sa”.
2.Check to make sure the database has been marked “suspect.” The following query produces a list of all databases which are marked suspect:
1> select name from master..sysdatabases
2> where status &256 = 256
3> go
3.If the database is marked “suspect”, go to step 4. If it is not marked “suspect”, mark it in one of the following ways:
a.Execute the sp_marksuspect stored procedure discussed under “How to Mark a Database “suspect””, and restart Adaptive Server to initialize the change.
b.Use the procedure below:
1> sp_configure”allow updates”, 1
2> go
1> use master
2> go
1> begin transaction
2> update sysdatabasesset status = 256
3> where name = “database_name”
4> go
Verify that only one row was affected and commit the transaction:
1> commit transaction
2> go
Reset the allow updates option of sp_configure:
1> sp_configure “allow updates”, 0
2>go
Restart Adaptive Server to initialize the change.
4.Remove the database:
1> dbccdbrepair(database_name,dropdb)
2> go
dbcc dbrepair sometimes displays an error message even though it successfully drops the database. If an error message occurs, verify that the database is gone by executing the use database_name command. This command should fail with a 911 error, since you dropped the database. If you find any other error, contact Sybase Technical Support.
How to move the master database to a new device
- Dump the user databases with the dump database command.
- Rename the dumped databases on the master device with sp_renamedb.
- Re-create the databases with their original names on another device with create database. Be sure they are created exactly like the old databases, to avoid 2558 and other errors. Refer to Error 2558 for more information.
- Load the dumps with load database.
- Use the online database command for each database to make the databases available for use.
- Check the databases in their new location to make sure the load was successful (that is, perform a simple query with isql), and if everything loaded successfully, drop the old databases from the master device.
- Back up the master database with the dump database command.
- Save the contents of key system tables such as sysdatabases, sysdevices, sysusages, and syslogins. Make a note of these values. Also make a note of the path to the dump device in sysdevices.
- Use the buildmaster utility to build a new master device with enough extra space so that you will never need to increase the master device again. When buildmaster completes, a new master database will exist on the new master device. The buildmaster executable is found in bin, so use ./buildmaster and follow the prompts.
- You now need to create a new runserver file which points to this new master device (the -d option). And start up the server with this new runserver file.
- Expand the size of the new master database with the alter database command, if necessary, so that it matches the size of the dumped master database(get this info from the original sysusages table where the size is in 2k blocks, the alter database command uses sizes in MB).
- Execute the following command in isql:
- Add the –m option to the runserver file to start Adaptive Server in single-user mode.
- Allow updates to the system catalog:
- Change the value for srvnetname in sysservers from SYB_BACKUP to the name of your backup server.
- Load the dump of the master database, using load database master from <full path name>.
- Reset the “high” value in master..sysdevices:
- If the previous update affected only one row, commit the transaction.
- Restart Adaptive Server.
- Turn off allow updates:
- Edit the new runserver file to take it out of single user mode, i.e remove the –m option and restart the server, if this all works fine (leave it for a while) then you can remove the original master device and its related run server file.