Labels

admin (1) aix (1) alert (1) always-on (2) Architecture (1) aws (3) Azure (1) backup (3) BI-DWH (10) Binary (3) Boolean (1) C# (1) cache (1) casting (3) cdc (1) certificate (1) checks (1) cloud (3) cluster (1) cmd (7) collation (1) columns (1) compilation (1) configurations (7) Connection-String (2) connections (6) constraint (6) copypaste (2) cpu (2) csv (3) CTE (1) data-types (1) datetime (23) db (547) DB2 (1) deadlock (2) Denali (7) device (6) dotNet (5) dynamicSQL (11) email (5) encoding (1) encryption (4) errors (124) excel (1) ExecutionPlan (10) extended events (1) files (7) FIPS (1) foreign key (1) fragmentation (1) functions (1) GCP (2) gMSA (2) google (2) HADR (1) hashing (3) in-memory (1) index (3) indexedViews (2) insert (3) install (10) IO (1) isql (6) javascript (1) jobs (11) join (2) LDAP (2) LinkedServers (8) Linux (15) log (6) login (1) maintenance (3) mariadb (1) memory (4) merge (3) monitoring (4) MSA (2) mssql (444) mssql2005 (5) mssql2008R2 (20) mssql2012 (2) mysql (36) MySQL Shell (5) network (1) NoSQL (1) null (2) numeric (9) object-oriented (1) offline (1) openssl (1) Operating System (4) oracle (7) ORDBMS (1) ordering (2) Outer Apply (1) Outlook (1) page (1) parameters (2) partition (1) password (1) Performance (103) permissions (10) pivot (3) PLE (1) port (4) PostgreSQL (14) profiler (1) RDS (3) read (1) Replication (12) restore (4) root (1) RPO (1) RTO (1) SAP ASE (48) SAP RS (20) SCC (4) scema (1) script (8) security (10) segment (1) server (1) service broker (2) services (4) settings (75) SQL (74) SSAS (1) SSIS (19) SSL (8) SSMS (4) SSRS (6) storage (1) String (35) sybase (57) telnet (2) tempdb (1) Theory (2) tips (120) tools (3) training (1) transaction (6) trigger (2) Tuple (2) TVP (1) unix (8) users (3) vb.net (4) versioning (1) windows (14) xml (10) XSD (1) zip (1)
Showing posts with label SAP RS. Show all posts
Showing posts with label SAP RS. Show all posts

SAP RS - Sybase SSL error: Open Server error: Error: 16029, State: 0, Severity 20 -- 'Failed to start any network listeners'

Error:
F. 2020/08/02 08:25:22. FATAL ERROR #1030 GLOBAL RS(GLOBAL RS) - eneric/err/errhand.c(1262)
    Open Server error: Error: 16029, State: 0, Severity 20 -- 'Failed to start any network listeners'.
T. 2020/08/02 08:25:22. (-1): Exiting due to a fatal error.

Solution:
- see if the RS (or other service) run on the port that set to RS in the sql.ini/interfaces file:
sybase16@asazrlnsap16:/sybvol01/sap16rs/REP-16_0/install$ netstat -a | grep 11753
tcp        0      0 asazrlnsap16.inte:11753 0.0.0.0:*               LISTEN

- find the Process ID of the service:
sybase16@asazrlnsap16:~$ netstat -lntp | grep 11753
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 10.1.1.4:11753          0.0.0.0:*               LISTEN      61270/repserver

- kill the service:
sybase16@asazrlnsap16:~$ kill 61270

- check that the services were killed:
sybase16@asazrlnsap16:~$ ps -ef | grep 61270
sybase16  66053  65873  0 08:51 pts/2    00:00:00 grep --color=auto 61270
sybase16@asazrlnsap16:~$ netstat -lntp | grep 11753
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)


Start RS

SSL Configuration - SAP RS (Sybase RS)

How to setup self-signed SSL with SAP RS

On the server-side:
  1. Create an ASE certificate.
  2. Enable SSL in ASE (if required).
  3. Edit the interfaces/sql.ini file - add SSL definition.
  4. Enable SSL in RS.
  5. Restart RS.
A detailed description of the process to activate SSL for ASE

On the server-side:

If required: Installing OpenSSL on the machine.

1. Create an ASE certificate

If already done for your server - skip it. 
The certificates for the ASE on the server can be used also by the RS on this server.

8. Create/Copy the crt file to RS certificates folder
cd /sybvol01/sap16/OCS-16_0/bin/
cat ASAZRLNSAP16.public ASAZRLNSAP16.key > /sybvol01/sap16rs/REP-16_0/certificates/ASAZRLNSAP16.crt

File created: /sybvol01/sap16rs/REP-16_0/certificates/ASAZRLNSAP16.crt

9. Create  client certificate

9.a create ASAZRLNSAP16.txt in the RS certificates folder
cp root.crt /sybvol01/sap16rs/REP-16_0/certificates/ASAZRLNSAP16.txt

9.b add certificates content to the exists trusted.txt in the RS config folder (.../sap16rs/config/trusted.txt)

9.c copy more files to the RS certificates folder:
cp ASAZRLNSAP16.csr /sybvol01/sap16rs/REP-16_0/certificates/ASAZRLNSAP16.csr
cp ASAZRLNSAP16.key /sybvol01/sap16rs/REP-16_0/certificates/ASAZRLNSAP16.key
cp ASAZRLNSAP16.public /sybvol01/sap16rs/REP-16_0/certificates/ASAZRLNSAP16.public
cp root.crt /sybvol01/sap16rs/REP-16_0/certificates/root.crt
cp root.csr /sybvol01/sap16rs/REP-16_0/certificates/root.csr
cp root.key /sybvol01/sap16rs/REP-16_0/certificates/root.key


2. Enable SSL in ASE  (if required)

10. Enable ssl in ASE
→ if already done for the ASE (step 10) - skip it.
sp_configure "enable ssl", 1

11. Add ssl certificate into ASE (already done for ASE, step 11)


3. Edit the interfaces/sql.ini file - add SSL definition

12. Edit the interfaces/sql.ini file to create an ssl port:
ASAZRLNSAP16
    master tcp ether ASAZRLNSAP16 5000 ssl="CN=ASAZRLNSAP16"
    query tcp ether ASAZRLNSAP16 5000 ssl="CN=ASAZRLNSAP16"
 
RSFOG2 
   master tcp ether ASAZRLNSAP16 11753 ssl="CN=ASAZRLNSAP16"
   query tcp ether ASAZRLNSAP16 11753 ssl="CN=ASAZRLNSAP16"



4. Enable SSL in RS

13. Grant execute permissions for sp_serverinfo (CR# 814027)
use sybsystemprocs
go
grant execute on sp_serverinfo to public
go


14. Enable SSL on RS
1> configure replication server set use_ssl to 'on'
2> go
Config parameter 'use_ssl' is modified. This change will not take effect until the Replication Server is restarted.



5. Restart and do checks

15. Restart RS
Stop RS:
1> shutdown
2> go

Start RS:
cd /sybvol01/sap16rs/REP-16_0/install/
startserver -f RUN_RSFOG2

  • Windows: stop and start the service in Services.

16. Check that SSL is enabled:

1> use RSFOG2_RSSD
2> go
1> select * from rs_config where optionname like "%ssl%"
2> go
optionname                     objid              charvalue         status comments                                                                                                                                             
 ------------------------------ ------------------ -------------
 ssl_protocol                   0x0000000000000000 TLSv1        0 Indicated the SSL protocol value of Replication Server.                                                                                                                     
 use_ssl                        0x0000000000000000 on
   
should be:
1. ssl_protocol is not null
2. ssl_protocol is on

1> select @@ssl_ciphersuite
2> go
 ------------------------------
 TLS_RSA_WITH_AES_256_CBC_SHA

SAP RS - The transaction log in database RSSD is almost full

What happened?
Error when trying to start SAP Replication Server.

Error Message:
E. 2020/12/14 21:39:52. ERROR #11061 GLOBAL RS(GLOBAL RS) - generic\sts\stscol.c(2631)
Check the log for error messages from RSSD.
I. 2020/12/14 21:39:52. Message from server: Message: 7415, State 1, Severity 10 -- 'The transaction log in database RS1_RSSD is almost full. Your transaction is being suspended until space is made available in the log.

Reason:
Cause of the error: The transaction lof of the RSSD database is (almost) full.

Solution:
use master
go

sp_helpdb RS1_RSSD  --a check
sp_helpdevice rssd_log --a check

disk resize name = "rssd_log", size = "1500M"
go

alter database RS1_RSSD log on rssd_log = "1500M"
go

SAP RS - Create a new Replication

Before declaring a Replication

We should have:

  • Primary database and Replicate database/s.
  • Instances were set in sql.ini.
  • RSSD database.

Create a primary database

use master
go
 
-- Create devices
disk init name="RepTestPrimaryDdevice", physname="/sybvol01/sap16/data/RepTestPrimaryDdevice1.dat", size="100M"
GO
 
disk init name="RepTestPrimaryDdeviceLog", physname="/sybvol01/sap16/data/RepTestPrimaryDdeviceLog1.dat", size="100M"
GO
 
-- Create a Database
create database RepTestPrimary on RepTestPrimaryDdevice='100M' log on RepTestPrimaryDdeviceLog='100M'
GO
 
use RepTestPrimary
go
-- Create a Segment
sp_addsegment RepTestPrimarySeg, RepTestPrimary, RepTestPrimaryDdevice
GO

Create a replicate database

use master
go
 
-- Create devices
disk init name="RepTestReplicateDdevice", physname="/sybvol01/sap16/data/RepTestReplicateDdevice1.dat", size="100M"
GO
 
disk init name="RepTestReplicateDdeviceLog", physname="/sybvol01/sap16/data/RepTestReplicateDdeviceLog1.dat", size="100M"
GO
 
-- Create a Database
create database RepTestReplicate on RepTestReplicateDdevice='100M' log on RepTestReplicateDdeviceLog='100M'
GO
 
use RepTestReplicate
go
-- Create a Segment
sp_addsegment RepTestReplicateSeg, RepTestReplicate, RepTestReplicateDdevice
GO

Create a replicated table

use RepTestPrimary
go
 
create table dbo.FirstTable (ID numeric(10, 0) not null, IntColumn int null, StrColumn varchar(20) null)
go
alter table dbo.FirstTable add constraint pkFirstTable primary key (ID)
go
 
-- =============================================================
use RepTestReplicate
go
 
create table dbo.FirstTable (ID numeric(10, 0) not null, IntColumn int null, StrColumn varchar(20) null)
go
alter table dbo.FirstTable add constraint pkFirstTable primary key (ID)
go

  • The replicated table must have a primary key!

Create connections to the primary and replicated server

cd /sybvol01/sap16rs/REP-16_0/install/
./rs_init

Add a database to the replication system

2.  Configure a Server product

Choose: "2. Configure a Server product"

Choose: "1. Replication Server"

Choose: "2. Add a database to the replication system"

In windows:


Replication Server Information


Choose: "1. Replication Server Information"

Choose: "1. Replication Server Name"Choose: "RS SA password"

Ctrl-a Accept and Continue


In windows:


Database Information

Add the primary database


Choose: "2. Database Information"

Choose: "1. SQL Server name"
For the primary database: set "5. Will the database be replicated" to "yes".
Ctrl-a Accept and Continue

Choose: "3. SA password"

Choose: "4. Database name"

Choose: "7. Maintenance password"

Choose: "3. Database Replication Agent"

Choose: "2. RS password"


Change RS user to sa.


Ctrl-a Accept and Continue


Ctrl-a Accept and Continue, Approve to run the task.

Execute the Replication Server tasks now? y
Running task: check the SQL Server.
Task succeeded: check the SQL Server.
Running task: verify users and their passwords.
Verified that 'sa' can log into Replication Server 'RSFOG2'.
Verified that 'sa' can log into Replication Server 'RSFOG2'.
Task succeeded: verify users and their passwords.
Running task: check the database.
Verified that database 'RepL16TestPrimary' exists.
Verified that SQL Server 'SERVERNAME' supports replication.
Added maintenance user login 'RepL16TestPrimary_maint' to database 'RepL16TestP
rimary'.
Verified that maintenance user 'RepL16TestPrimary_maint' can log into SQL Serve
r 'SERVERNAME'.
Task succeeded: check the database.
Running task: configure database for primary data.
Loading script 'rs_install_primary.sql' into database 'RepL16TestPrimary'.
.....Done
Loaded script 'rs_install_primary.sql' successfully.
Done
Granting permissions on the lastcommit functions and rs_marker.
Granting permissions on the lastcommit functions.
Granted maintenance user permissions on the lastcommit functions and rs_marker.

Granted replication role to maintenance user
Task succeeded: configure database for primary data.
Running task: configure the Replication Agent.
Task succeeded: configure the Replication Agent.
Running task: set connection to the database.
Adding database 'RepL16TestPrimary' to the replication system.
Successfully executed 'create connection'. Database 'RepL16TestPrimary' is now
managed by Replication Server 'RSFOG2'.
Task succeeded: set connection to the database.
Running task: start the Replication Agent.
Task succeeded: start the Replication Agent.

Configuration completed successfully.
Press <return> to continue.

Add a replicate database

Do the same as for the primary database, with the following changes:

  1. For the replicate databases: set "5. Will the database be replicated" to "no".
  2. "Database Replication Agent" definition is not required.

Ctrl-a Accept and Continue, Approve to run the task.


Execute the Replication Server tasks now? y
Running task: check the SQL Server.
Task succeeded: check the SQL Server.
Running task: verify users and their passwords.
Verified that 'sa' can log into Replication Server 'RSFOG2'.
Task succeeded: verify users and their passwords.
Running task: check the database.
Verified that database 'RepL16TestReplicate' exists.
Added maintenance user login 'RepL16TestReplicate_maint' to database 'RepL16Tes
tReplicate'.
Verified that maintenance user 'RepL16TestReplicate_maint' can log into SQL Ser
ver 'SERVERNAME'.
Task succeeded: check the database.
Running task: configure database for replicate data.
Loading script 'rs_install_replicate.sql' into database 'RepL16TestReplicate'.
...Done
Loaded script 'rs_install_replicate.sql' successfully.
Done
Granting permissions on the lastcommit functions.
Granted maintenance user permissions on the lastcommit functions.
Granted replication role to maintenance user
Task succeeded: configure database for replicate data.
Running task: set connection to the database.
Adding database 'RepL16TestReplicate' to the replication system.
Successfully executed 'create connection'. Database 'RepL16TestReplicate' is no
w managed by Replication Server 'RSFOG2'.
Task succeeded: set connection to the database.

Configuration completed successfully.
Press <return> to continue.

In windows:


Create replication definition, publication and subscription

Create a replication definition


Replication definition is defined at the primary database.

Connect to the RS:
isql64 -S RSFOG2 -Usa -Ppassword -w2048

create replication definition RepL16TestDef
with primary at SERVERNAME.RepL16TestPrimary
with all tables named 'FirstTable'
(ID numeric,
IntColumn int,
StrColumn varchar(20))
primary key(ID)
replicate minimal columns
go

Expected output:
Replication definition 'RepL16TestDef' is created.

Create a publication


Publication is defined at the primary database.

Connect to the RS:
isql64 -S RSFOG2 -Usa -Ppassword -w2048

create publication RepL16TestPub with primary at SERVERNAME.RepL16TestPrimary
go

Expected output:
-- Publication 'RepL16TestPub' for SERVERNAME.RepL16TestPrimary is created.


Create a subscription

Subscription is defined at the replicate database.

Connect to the RS:
isql64 -S RSFOG2 -Usa -Ppassword -w2048

create subscription RepL16TestSub for RepL16TestDef with replicate at SERVERNAME.RepL16TestReplicate
go

Expected output:
Subscription 'RepL16TestSub' is in the process of being created.

check subscription RepL16TestSub for RepL16TestDef with replicate at SERVERNAME.RepL16TestReplicate
go

Expected output:
Subscription RepL16TestSub is VALID at the replicate.
Subscription RepL16TestSub is VALID at the primary.

Validation and checks for the connections and the definitions


Connect to the RS:

isql64 -S RSFOG2 -Usa -Ppassword -w2048


1> admin who

2> go

Spid Name State Info

---- --------------- -------------------- ------------------------------------------------------------

...

304 DSI EXEC Awaiting Command 109(1) SERVERNAME.RepL16TestPrimary

299 DSI Awaiting Message 109 SERVERNAME.RepL16TestPrimary

301 DIST Awaiting Wakeup 109 SERVERNAME.RepL16TestPrimary

303 SQT Awaiting Wakeup 109:1 DIST SERVERNAME.RepL16TestPrimary

300 SQM Awaiting Message 109:1 SERVERNAME.RepL16TestPrimary

298 SQM Awaiting Message 109:0 SERVERNAME.RepL16TestPrimary

302 REP AGENT Awaiting Command SERVERNAME.RepL16TestPrimary

311 DSI EXEC Awaiting Command 110(1) SERVERNAME.RepL16TestReplicate

310 DSI Awaiting Message 110 SERVERNAME.RepL16TestReplicate

309 SQM Awaiting Message 110:0 SERVERNAME.RepL16TestReplicate

...


Connect to the RSSD in the ASE:

isql64 -S SERVERNAME -Usa -Ppassword -w2048 -X


1> use RSFOG2_RSSD

2> go

1> select * from rs_databases

2> go

dsname dbname dbid dist_status src_status ....

----------------- -------------------- ----------- ----------- ----------- ....

...

SERVERNAME RepL16TestPrimary 109 1 1 ....

SERVERNAME RepL16TestReplicate 110 1 0 ....

...

(8 rows affected)

  • rs_helpdb can also be good: exec rs_helpdb.


Add database and table to replication

Connect to the primary database in the ASE:
isql64 -S SERVERNAME -Usa -Ppassword -w2048 -X

1> USE RepL16TestPrimary
2> go

1> -- displays the current replication status of a table:
2> sp_setreptable FirstTable
3> go

The replication status for 'FirstTable' is currently false, owner_off, primary key = 'pkFirstTable'.
(return status = 0)

1> -- add table to replication
2> sp_setreptable FirstTable, true
3> go
The replication status for 'FirstTable' is set to true, owner_off.
(return status = 0)

1> -- displays the current replication status of a table:
2> sp_setreptable FirstTable
3> go
The replication status for 'FirstTable' is currently true, owner_off, primary key = 'pkFirstTable'.
(return status = 0)

1> -- check replication status for database:
2> sp_reptostandby RepL16TestPrimary
3> go
The replication status for database 'RepL16TestPrimary' is 'NONE'.
The replication mode for database 'RepL16TestPrimary' is 'off'.
(return status = 0)

1> -- activate replication status for database
2> sp_reptostandby RepL16TestPrimary, 'all'
3> go
Warning: The execution of the stored procedure sp_reptostandby will take time to process all the tables and all the text/image columns in database 'RepL16TestPrimary'.
The replication status for database 'RepL16TestPrimary' has been set to 'ALL'.
(return status = 0)

1> -- check replication status for database
2> sp_reptostandby RepL16TestPrimary
3> go
The replication status for database 'RepL16TestPrimary' is 'ALL'.
The replication mode for database 'RepL16TestPrimary' is 'off'.
(return status = 0)


Grant permissions to maint user on replicated DB

Connect to the replicate database in the ASE:

isql64 -S SERVERNAME -Usa -Ppassword -w2048 -X

use RepL16TestReplicate
go
GRANT INSERT ON dbo.FirstTable TO RepL16TestReplicate_maint
go
GRANT UPDATE ON dbo.FirstTable TO RepL16TestReplicate_maint
go
GRANT DELETE ON dbo.FirstTable TO RepL16TestReplicate_maint
go


Activate Rep Agent

-- Connect to the primary database and to the RSSD in the ASE:
isql64 -S SERVERNAME -Usa -Ppassword -w2048 -X


1> use RepL16TestPrimary
2> go

1> -- let RepAgent sends changes to the replicate database
2> sp_config_rep_agent RepL16TestPrimary, send_warm_standby_xacts, true
3> go

Parameter_Name Default_Value Config_Value Run_Value
----------------------- ------------- ------------ ---------
send warm standby xacts false true false
(1 row affected)
Replication Agent configuration changed for database 'RepL16TestPrimary'. The changes will take effect the next time the Replication Agent thread is started.
(return status = 0)

1> -- config connect dataserver to the ASE name
2> sp_config_rep_agent RepL16TestPrimary, 'connect dataserver', 'SERVERNAME'
3> go

Parameter_Name Default_Value Config_Value Run_Value
------------------ ------------- ------------ ------------
connect dataserver SERVERNAME SERVERNAME SERVERNAME 
(1 row affected)

Replication Agent configuration changed for database 'RepL16TestPrimary'. The changes will take effect the next time the Replication Agent thread is started.
(return status = 0)

1> sp_config_rep_agent RepL16TestPrimary, 'enable', 'RSFOG2', 'sa', 'password'
2> go
Msg 18382, Level 16, State 1:
Server 'SERVERNAME', Procedure 'sp_config_rep_agent', Line 664:
Database 'RepL16TestPrimary' is already configured to use Replication Agent. Request to enable Replication Agent has been ignored.
(return status = 1)
→ Bebause it already done in rs_init. No problem. 

1> -- stop RepAgent
2> sp_stop_rep_agent RepL16TestPrimary
3> go
The Replication Agent thread for database 'RepL16TestPrimary' is being stopped.
(return status = 0)


1> use RSFOG2_RSSD
2> go
1> rs_zeroltm 'SERVERNAME', 'RepL16TestPrimary'
2> go
Locater has been reset to zero.
(return status = 0)

1> use RepL16TestPrimary
2> go
1> dbcc settrunc(ltm, valid)
2> go
secondary trunc page secondary trunc state dbrepstat generation id database id database name ltl version
-------------------- --------------------- --------- ------------- ----------- ------------------------------ -----------
25757 1 175 0 14 RepL16TestPrimary 760

1> -- truncate the log
2> dump tran RepL16TestPrimary with no_log
3> go

1> -- grant permissions
2> grant role replication_role to sa
3> go

1>
2> -- start RepAgent
3> sp_start_rep_agent RepL16TestPrimary
4> go
Replication Agent thread is started for database 'RepL16TestPrimary'.
(return status = 0)


View information about all definitions and declarations


In the primary database:

sp_config_rep_agent RepL16TestPrimary
go

sp_help_rep_agent "RepL16TestPrimary"
go

sp_displaylogin sa
go

In the Replication Server:

admin who
go

admin who_is_down
go



In RSSD:

rs_helpdbrep DETestDB_repdef, win16, DETestDBPrimary
go

rs_helpcheckrepdef
go

rs_helprep DETestDB_repdef
go

rs_helpdbsub DETestDB_pub_subscript, ubuntu16, DETestDB
go

select * from rs_subscriptions A
go

select * from rs_dbreps B
go

select * from rs_sites --B
go

select * from rs_databases --C
go


Check the replication


Connect to the primary database and to the replicate database in the ASE:
isql64 -S SERVERNAME -Usa -Ppassword -w2048 -X

  1. Insert data to the primary table.
  2. Check if it was replicated in the replicate database.

1> use RepL16TestPrimary
2> go
1> INSERT INTO dbo.FirstTable ( ID, IntColumn, StrColumn ) VALUES ( 1, 1, 'Str 1' )
2> go
(1 row affected)
1> select * from dbo.FirstTable
2> go
ID IntColumn StrColumn
------------- ----------- --------------------
1 1 Str 1
(1 row affected)
1> use RepL16TestReplicate
2> go
1> select * from dbo.FirstTable
2> go
ID IntColumn StrColumn
------------- ----------- --------------------
1 1 Str 1
(1 row affected)



SAP (sybase) RS - rs_init - Could not connect to ID Server Unable to execute query create connection

The case:

Error when adding a new connection using rs_init: 

Could not connect to ID Server Unable to execute query create connection.


Error message:

WARNING: "Could not connect to ID Server 'ID_RS_NAME'."

Press <return> to continue.

SQL Server message: msg 45, level 12, state 0


WARNING: "Could not connect to ID Server 'ID_RS_NAME'."

Press <return> to continue.


Unable to execute query 'create connection to "ASENAME"."DBNAME" s

et error class rs_sqlserver_error_class set function string class rs_sqlserver_

function_class set username "DBNAME_maint" set password *** with log tr

ansfer on' against server 'RS_NAME'.

Press <return> to continue.



Solution:

The ID Server RS is not available:

  1. The RS service is down - start it.
  2. Network or connections problems.
  3. Any other reason


SAP (sybase) RS - Displays connection data for the Replication Server

In order to displays connection data for the Replication Server, 

connect SRS, and run:

admin show_connections

go

SAP (sybase) RS - some basic and useful scripts and queries

Select RS version

1. Login RS and run:

admin version

2. Without login:

cd $SYBASE/REP-16_0/bin/

repserver -v


A list of running / not running components

admin who

admin who_is_down

(Executed from RS)


Get the name and path of the RS log

admin log_name

(Executed from RS)


Information about databases and replication definitions

select * from rs_databases

select * from rs_subscriptions

select * from rs_publications

select * from rs_dbreps

exec rs_helpdb

exec rs_helprep

exec rs_helpsub

(Executed from RSSD databse)

SAP (sybase) RS: Permission error while using rs_init

Error message:

Permission denided. You must either be the database/object owner or process any of the following roles in order to perform this operation: sa_role, replication_role
failed to execute 'dbcc is_replication_enabled' as user RS1_RSSD_prim

Solution:
Grant required roles to the relevant users:

use RS1_RSSD
go
grant role sa_role to RS1_RSSD_prim
go
grant role replication_role to RS1_RSSD_prim
go

SAP (sybase) RS: RSI USER become Inactive

Problem:
Replications via the routing don't work and RSI  is inactive (checking with"admin who_is_down") 

1> admin who_is_down
2> go
Spid     Name   State    Info
------- -------   ------- -------
            RSI       Down   RS2

Solution:
Resume route:
1> resume route to RS2
2> go
Route to 'RS2' is resumed.

Check that nothing is down:
1> admin who_is_down
2> go
Spid     Name   State    Info
------- -------   ------- -------

1>

Enabling Password Encryption for SAP (Sybase) RS

Encrypted Password RS can be set in 2 ways:
  1. RS that it's RSSD is set with encrypted password.
  2. RS that is itself set with encrypted password (Encrypted password RS).

RS that its RSSD is set with encrypted password

This configuration means that:
  1. The RS that itself is not set with encrypted password.
  2. The RSSD of the RS is set with encrypted password (more correct: the ASE instance where the RSSD is stored is set with encrypted password).

On the RS, we need to set "send_enc_password” to 'on' - from RS or in the configuration file.

From RS:
  1. login RS.
  2. configure “replication server set send_enc_password"
  3. Restart RS
1> configure replication server set send_enc_password to 'on'
2> go

From the configuration file:
  1. Set the configuration parameter "RS_send_enc_pw" to “on” in the rs_name.cfg file.
  2. Restart RS.

In order to make routing works, It has to be done in the ‘source’ RS of the routing and in any other RS that connects to the “encrypted password” ASE instance.


Encrypted password RS

By default, RS is passwords encrypted.
When installing a new RS - it uses password encryption.

Verify that password encryption is enabled in RS

There are few checks in order to verify that password encryption is enabled or not for an exists RS system.

1. Check the password_encryption configuration

select objid, optionname, charvalue=substring(charvalue,1,25) from rs_config where optionname = 'password_encryption'
go

2. Check these parameters in the configuration file and see that they are encrypted: RSSD_primary_pw_enc, RSSD_maint_pw_enc, ID_pw_enc, RS_random.


Manage password encryption in RS

If your RS environment is not set with password encryption (probably old installation), you can enable it using rs_init.
The process is described in the following chart and in SAP site (Enabling password encryption for a Replication Server).

Altering an encrypted password in RS can be done using rs_init, as described in SAP site: Altering an encrypted password for a Replication Server.


More queries:

1> use YOUR_RSSD
2> go
1> select username, uid, use_enc_password, enc_password from rs_users
2> go

1> use YOUR_RSSD
2> go
1> select * from rs_encryptionkeys
2> go



Can I disable password encryption for RS?
Password encryption can be disabled for RS, but then the passwords would be exposed in the RSSD and SRS cfg file.

It looks like there is no good reason to do that.

Disabling Password Encryption:
  1. Set password_encryption to '0'
  2. Change existing passwords in the RSSD tables to clear text
    1. Change in rs_users and rs_maintusers tables.
    2. There is no way to decrypt the passwords listed in the rs_users and rs_maintusers.
    3. Changing passwords with the alter user SRS command for SRS users, or the alter connection command for the maintenance users.
    4. Once you change the password on a connection for a maintenance user, you will need to change it at the replicate dataserver and resume the connection.
  3. Change existing passwords in the Replication Server configuration file: manually reenter, in clear text, passwords that are currently encrypted.
  4. Restart RS.

configure replication server set password_encryption to '0'
go



Enabling Password Encryption for SAP ASE (Sybase)

Enabling Password Encryption for SAP ASE is done by the enabling “net password encryption reqd” on the ASE server.
  1. Set 'net password encryption reqd' = 1 (or 2, check the values on SAP site)
  2. Restart ASE.
sp_configure 'net password encryption reqd', 1
go


In order to connect this ASE, you need an encryption of the login password.

For example, in isql you need to add the "-X", that Initiates the login connection to the server with client-side password encryption.



Also for connections from RSs, Replications to this server can’t be replicated until we set the connection to it from the other RS (“send_enc_password” parameter, see here).


SAP RS - RSI USER become Inactive

Error:
RSI USER become Inactive .
Replications via the routing don't work and RSI  is inactive (checking with"admin who_is_down") 

1> admin who_is_down
2> go
Spid     Name    State    Info
-------   -------      -------    -------
            RSI        Down   RS2

Solution:
Resume route:

1> resume route to RS2
2> go
Route to 'RS2' is resumed.

Check:
1> admin who_is_down
2> go
Spid     Name    State    Info
-------   -------      -------    -------
1> 

SAP Replication Server Routing

How does it work?
In a "standard" replication - we have a replication definition and subscription that declare the replication between database A to database B (and C, D, ...).

In a routing replication there is one more step before the target replicated database - another RS.

The second RS should know when and what to replicate to it's target DB.

The route from The first RS to the second, and specific between their RSSDs - replicate the required definitions (rep. definition, etc.) from the first RSSD to the second one.

When the second RSSD has these definitions - we can create a subscription on the second RS from the source database to the target database. This is how it works.

Before declare a routing
  1. Two replication servers are installed and started.
  2. All target databases must have the same columns and Primary key.
  3. No identity in the target table (or subscription that know to update identity column).

Importent notes:
  1. The passwords to all RSs in the process should be the same.
  2. The RepAgent has to use a known servers names (in the ini files).
  3. Source and target tables must have a primary keys.

Routing definitions

Init servers
  1. Edit the ini file in the new server with:
    1. Current (new) RS.
    2. ASE instance of the RSSD.
    3. ASE instance of the replicatec(=target) database.
    4. First (=source) RS.
  2. Edit the ini of the first (=source) RS with:
    1. New RS.
    2. ASE instance of the source RSSD.
  3. Run rs_init:
    1. Two ways to do that:
      1. run rs_init
      2. create <SAP_RS_FOLSER>/REP-16_0/init/rs/RS2.rs (copied and edited from install.rs) and run it
        1. ./rs_init -r ../init/rs/RS2.rs
    2. In rs_init we define the servers, databases, RSSDs, users, etc.
  4. Check that RS is up:
    1. isql64 -S RSFOG2 -Usa -P<password>
    2. admin version
      go
    3. admin who
      go


Manage the route

#

RS1 (source RS)

RSSD of RS1 (RS1_RSSD)

RS2 (second RS)

Target replicated database

1

Create route

alter connection to SERVERNAME.RS1_RSSD set log transfer ON
go

create route to RS2
set username sa
set password PASSWORD
go

 

 

 

1.a

Monitor the new route until it became active

 

1> rs_helproute
2> go
 route        route_status                                                                                                 
 ----------------------------------
RS1 --------> RS2
Route is being created. Destination has not yet finished creating system table subscriptions.
 Systable Subs to be created
…… (list of what created)

* re-run to re-check untio all created.

 

 

2

add connection RS2 (second RS) → target database

 

Use rs_init

Declare DATABASE INFORMATION

1. SQL Server name: (target ASE)
2. SA user: sa
3. SA password: ******
4. Database name: (target database name)
5. Will the database be replicated: no

6. Maintenance user: <target database name>_maint
7. Maintenance password: ******
8. Is this a Physical Connection for Existing Logical Connection: no

Can be done also with "create connection" command.

 

3

Configure a  rep_agent to the RSSD

 

1> use RS1_RSSD
2> go
1> sp_config_rep_agent RS1_RSSD , 'enable' , 'RS1' , 'sa' ,'PASSWORD'
2> go
Replication Agent enabled for database 'RS1_RSSD'. The Replication Agent thread needs to be started using sp_start_rep_agent.
(return status = 0)
1> sp_start_rep_agent RS1_RSSD
2> go
Replication Agent thread is started for database 'RS1_RSSD'.
(return status = 0)

 

 

4

Grant permissions in the target database

 

 

 

1> grant all on FirstTable to  <target database name>_maint
2> go

5

create a subscription to the replicate connection in the second RS

 

 

1> create subscription subTest3 for repdefTest with primary at PRIMARYDBSERVERNAME.PRIMARYDB with replicate at TARGETDBSERVER.TARGETDBNAME without materialization
2> go
Subscription 'subTest3' is in the process of being created.
1> check subscription subTest3 for repdefTest with primary at PRIMARYDBSERVERNAME.PRIMARYDB with replicate at TARGETDBSERVER.TARGETDBNAME
2> go