Monday, May 22, 2017

How to Create a SAP Sybase ASE Warm Standby Environment Using rs_init step by step|How to use rs_init utility to create a SAP Sybase ASE Warm Standby Environment

How to Create a SAP Sybase ASE Warm Standby Environment Using rs_init step by step

consider the following example
we have request to setup the ASE warm standby Replication setup
so We are using Linix env


Sybase ASE primary Server Name:-ActiveASE01
Sybase ASE replicated Server Name:-StandbyASE02
Sybase replication server name:-Rep157_01

Sybase ASE version 15.7 and
Sybase replication server 15.7
Using the Pubs2 database

Step-1)Login to ActiveASE01 and enable the Rep_Aganet

sp_configure 'enable rep agent',1
go

Step-2)Login to StandbyASE02 and enable the Rep_Aganet

Similary for StandbyASE02
sp_configure 'enable rep agent',1
go

Step-3) Now connect the replication server RS157_01 and create the logical connection

create logical connection to LASE.pubs2
go

//Please make note LogicalServerName.DatabaseName(LASE.pubs2)


Step-4) We need to create the physical Active connection using RS_INIT for Active server(ActiveASE01)

Now begain the rs_init utility

cd $SYABSE/REP-15_5/install
./rs_init

It prompts below options

=>RS_INIT
1.Release directory: /opt/sybaserep/157
2.Configure a Server product

Pick option2

=>Configure a Server product
 1.Replication Server


Configure Replication Server
1.Install a new replication Server
2.Add a database to replication  system
3.Upgrade an existing replication server
4.Downgrade RSSD for an existing replication server
5.Upgrade an existing database in the replication server
6.Enable password encryption for replication server
7.Alter a Replicaiton Serevr Confgireation file password

choose2
1.Replication Server Information
2.Database Information

choose 1-Replication Server Information
replication Server :-RS157_01
Password :- Sybase123

choose 2 Database Information
then we have
1.SQL Sevre name:ActiveASE01
2.SA User :sa
3.SA passord :Sybase123
4.Database name:pubs2
5.will database be replicate Yes
6.Maintenance User:pubs2_maint
7.Maintenance Password:Sybase123
8.Is this a Physical Connection for existing Logical Connection :Yes
9.Logical DB setup

Choose 9
Logiacl Connection Infrmaton
1.IS this an active Connection or standby connection active  //Active Connection
2.Locical DS Name:-LASE
3.Logical DB Name:-Pubs2

Replication agent informatio
RS User: REP157_01_ra
RS Password: Sybase123

Executre Replication Server task to activate the Replication

Step-5)Now login to ActiveASE01
use pubs2
go
sp_repstandby 'pubs2',all    //replicate data schema changes
go


Step-6) Now sync login

bcp master..syslogins out '/var/opt/sybase/DUMP/ActiveASE01/syslogins.out' -Usa -SASE1 -PSybase123 -c -n

Login to StandbyASE02

sp_configure ‘allow updates’,1  //turned on sp_configure system update
go

performed bcp in StandbyASE02

sp_configure ‘allow updates’,0   //turned off sp_configure system update
go


Add minatence user to  StandbyASE02
use pubs2
go
sp_adduser pubs2_maint
go


Step-7)Now we are working on standby connection StandbyASE02

Now need to create physical connection using rs_init utility

cd $SYABSE/REP-15_5/install
./rs_init

will get below options
=>RS_INIT
1.Release directory: /opt/sybaserep/157
2.Configure a Server product

pick option2

=>Configure a Server product
 1.Replication Server


Configure Replication Server
1.Install a new replication Server
2.Add a database to replication  system
3.Upgrade an existing replication server
4.Downgrade RSSD for an existing replication server
5.Upgrade an existing database in the replication server
6.Enable password encryption for replication server
7.Alter a Replicaiton Serevr Confgireation file password

choose2
1.Replication Server Information
2.Database Information
choose 1-Replication Server Information
replication Server :-RS157_01
Password :- Sybase123

choose 2 Database Information
then we have
1.SQL Sevre name :StandbyASE02
2.SA User :sa
3.SA passord:Sybase123
4.Database name:pubs2
5.will database be replicate
6.Maintenance User:pubs2_maint
7.Maintenance Password:Sybase123
8.Is this a Physical Connection for existing Logical Connection :Yes
9.Logical DB setup

Choose 9
Logiacl Connection Infrmaton
1.IS this an active Connection or standby connection active
2.Locical DS Name:-LASE
3.Logical DB Name:-Pubs2
4.Active DS name:-ActiveASE01
5.Active DB Name:-pubs2
6.Active DB sa User: sa
7.Active DB sa Password:Sybase123
8.Initialise sandtby using dump and load :Yes
9.Use Dump marker to start replication to standby :-Yes


Replication agent informatio
RS User ASE156_01_ra
RS Password: Sybase123

Execture the Replication Server task


Step-8) Login active server ActiveASE01

dump database Pubs2 to ‘/var/opt/sybase/dump/ActiveASE01/pubs2.01022017.dmp’
go


Step-9) Login standby server StandbyASE02

Load database Pubs2 from “/var/opt/sybase/dump/StandbyASE02/pubs2.01022017.dmp
go
online database pubs2
go

Step-10) Now add maitenance user to dbo

use pubs2
go
sp_dropuser pubs2_maint
go

sp_addaliase pubs2_maint,dbo
go


Step-11) Login to rep server RS157_01
admin logical_status
go

resume connection to ActiveASE01.pubs2
go
resume connection to StandbyASE02.pubs2
go


admin logical_status
go
admin who_is_down
go


Step-12)
// Now we will test the Active standby ASE enviournment ,Login ActiveASE01:-create the table t1 in pubs2 ,Validate the replication server
create table t1 (int a,int b)
go

insert t1 vaues (1,2)
go

Login to StandbyASE02
use pubs2
go
select * from t1
go

You will find all data replicated in StandbyASE02 from ActiveASE01

Database Refresh steps click here

How to performed database refresh step by step in SYABSE ASE |Steps invloved in database dump and load |step by step database refresh in SYABSE ASE

Production server instance name :-ASEPPROD01
Database name:-Prodb
Development server instance name:-ASEDEV02
Database name:-Devdb

Steps Involved in Database refresh:
Dump Database:
SCP
BCP (out)
LOAD Database
Online Database
Delete bcp out tables
BCP (in)

1)Dump Database: Dump database is used to make backup copy of the entire database.

dump database Prodb to ‘/var/opt/sybase/dump/ASEPPROD01/Prodb01022017.dmp’
go
2)SCP: The scp command used to copy files dump files from source server ASEPPROD01 to target Server ASEDEV02
The scp command uses ssh for data transfer.

scp -p ‘Prod0001:/var/opt/sybase/dump/ASEPPROD01/Prodb01022017.dmp’ ‘Dev0001:/var/opt/sybase/dump/ASEDEV02/’
3)This is OS level command used take copy of below system tabele sysusers,sysalternates and sysprotects in order to sync the user alias and permission etc

bcp Devdb..sysusers out ‘/var/opt/sybase/DUMP/ASEDEV02/Devdbsysusers.out’ -Usa -SASEDEV02 -PSybase123 -c -n

bcp Devdb..sysalternates out ‘/var/opt/sybase/DUMP/ASEDEV02/Devdbsysalternates.out’ -Usa -SASEDEV02 -PSybase123 -c -n

bcp Devdb..sysprotects out ‘/var/opt/sybase/DUMP/ASEDEV02/Devdbsysprotects.out’ -Usa -SASEDEV02 -PSybase123 -c -n

4)LOAD Database

Now login to server isql -Usa -SASEDEV02 -PSybase123 -w2000

use master
go
load database Devdb from “/var/opt/sybase/dump/ASEDEV02/Prodb01022017.dmp”
go
use Devdb
go
select @@servername,getdate()
go

Online Database Devdb
go

5)Once database is online then delete entries from below table so that we can performed bcp in operation

use Devdb
go
delete from Devdb..sysusers
go
delete from Devdb..sysprotects
go
delete from Devdb..sysalternates
go

6)Performed bcp in

bcp Devdb..sysusers in ‘/var/opt/sybase/DUMP/ASEDEV02/Devdbsysusers.out’ -Usa -SASEDEV02 -PSybase123 -c -n

bcp Devdb..sysalternates in ‘/var/opt/sybase/DUMP/ASEDEV02/Devdbsysalternates.out’ -Usa -SASEDEV02 -PSybase123 -c -n

bcp Devdb..sysprotects in ‘/var/opt/sybase/DUMP/ASEDEV02/Devdbsysprotects.out’ -Usa -SASEDEV02 -PSybase123 -c -n
7)How to check db refresh completed successfully.

i)MDA table master..monOpenDatabases

Select DBID,BackupInProgress,LastBackupFailed,TransactionLogFull,DBName,BackupStartTime,LastCheckpointTime,LastTranLogDumpTime from master..monOpenDatabases

ii)check backup errorlog

cat errorlog_ASEDEV02_BACKUP | grep -i ‘LOAD is complete’

Sybase ASE Replication Setup click here