Collection Contents Index Management overview Using message types pdf/chap10.pdf

Data Replication with SQL Remote
   PART 3. SQL Remote Administration
     CHAPTER 10. SQL Remote Administration       

Managing SQL Remote permissions


Users of a database involved in SQL Remote replication are identified by one of the following sets of permissions:

Information about these permissions are held in the SQL Remote system tables, and are independent of other database permissions.

Top of page  Granting and revoking PUBLISH permissions

When a database sends a message, a user ID representing that database is included with the message to identify its source to the recipient. This user ID is the publisher user ID of the database.

A publisher is required even for read-only remote databases within a replication system, as even these databases send confirmations to the consolidated database to maintain information about the status of the replication. The GRANT PUBLISH statement for remote Adaptive Server Anywhere databases is carried out automatically by the database extraction utility.

Granting and revoking PUBLISH permissions from Sybase Central 

You can grant PUBLISH permissions from Sybase Central. You must connect to the database as a user with full system or database administrator permissions.

  To set the publisher for a database:
  1. Open the SQL Remote folder.

  2. Double click Set Publisher, and select a user from the list.

  3. Click OK to set the selected user as the database publisher.

You can also revoke PUBLISH permissions from Sybase Central.

  To revoke PUBLISH permissions from Sybase Central:
  1. Open the SQL Remote folder. The current publisher is displayed in the right pane.

  2. Right-click the current publisher.

  3. Click Revoke Publish on the popup menu.

Granting and revoking PUBLISH permissions [Adaptive Server Anywhere] 

For Adaptive Server Anywhere, PUBLISH permissions are granted using the GRANT PUBLISH statement:

GRANT PUBLISH TO userid ;

The userid is a user with CONNECT permissions on the current database. For example, the following statement grants PUBLISH permissions to user S_Beaulieu:

GRANT PUBLISH TO S_Beaulieu

The REVOKE PUBLISH statement revokes the PUBLISH permissions from the current publisher:

REVOKE PUBLISH FROM userid

Granting and revoking PUBLISH permissions [Adaptive Server Enterprise] 

For Adaptive Server Enterprise, PUBLISH permissions are granted using the sp_publisher procedure:

sp_publisher userid

The userid is a user with CONNECT permissions on the current database. For example, the following statement grants PUBLISH permissions to user S_Beaulieu:

exec sp_publisher 'S_Beaulieu'
go

The database is set to have no publisher by executing the sp_publisher procedure with no argument:

exec sp_publisher
go

Notes on PUBLISH permissions 

Top of page  Granting and revoking REMOTE and CONSOLIDATE permissions

REMOTE and CONSOLIDATE permissions are very similar. Each database receiving messages from the current database must have an associated user ID on the current database that is granted one of REMOTE or CONSOLIDATE permissions. This user ID represents the receiving database in the current database.

Databases directly below the current database on a SQL Remote hierarchy are granted REMOTE permissions, and the at most one database above the current database in the hierarchy is granted CONSOLIDATE permissions.

Setting REMOTE and CONSOLIDATE permissions 

For Adaptive Server Anywhere, the GRANT REMOTE and GRANT CONSOLIDATE statements identify the message system and address to which replication messages must be sent.

For Adaptive Server Enterprise, the sp_grant_remote procedure sets REMOTE permissions, and the sp_grant_consolidate procedure sets CONSOLIDATE permissions.

CONSOLIDATE permissions must be granted even from read-only remote databases to the consolidated database, as receipt confirmations are sent back from the remote databases to the consolidated database. The GRANT CONSOLIDATE statement at remote Adaptive Server Anywhere databases is executed automatically by the database extraction utility.

Top of page  Granting REMOTE permissions

Each remote database must be represented by a single user ID in the consolidated database. This user ID must be granted REMOTE permissions to identify their user ID and address as a subscriber to publications.

Granting REMOTE permissions accomplishes several tasks:

Granting REMOTE permissions is also referred to as adding a remote user to the database.

Sybase Central example 

You can add a remote user to a database using Sybase Central.

  To add a new user to the database, as a remote user:
  1. Open the Remote Users folder in the SQL Remote folder.

  2. Double-click Add Remote User, and follow the instructions in the wizard.

  To make an existing user a remote user:
  1. Open the SQL Remote folder, so the Remote Users folder is displayed in the left pane.

  2. Open the Users and Groups folder, so that the user you want to make a remote user is displayed in the right pane.

  3. Drag the user icon in the right pane to the Remote Users folder in the SQL Remote folder on the left pane. The Make User a Remote User window is displayed.

  4. Select the message type from the list, enter an address, choose the frequency of sending messages, and click OK to make the user a remote user.

Adaptive Server Anywhere example 

The following statement grants remote permissions to user S_Beaulieu, with the following options:

GRANT REMOTE TO S_Beaulieu
TYPE smtp
ADDRESS 's_beaulieu@acme.com'
SEND AT '22:00'

Adaptive Server Enterprise example 

The following statement grants remote permissions to user S_Beaulieu with the following options:

exec sp_grant_remote 'S_Beaulieu',
   'file',
   'beaulieu',
   'SEND EVERY',
   '12:00'
go

Top of page  Selecting a send frequency

There are three alternatives for the setting the frequency with which messages are sent. The three alternatives are:

Top of page  Granting CONSOLIDATE permissions

In the remote database, the publish and subscribe user IDs are inverted compared to the consolidated database. The subscriber (remote user) in the consolidated database becomes the publisher in the remote database. The publisher of the consolidated database becomes a subscriber to publications from the remote database, and is granted CONSOLIDATE permissions.

At each remote database, the consolidated database must be granted CONSOLIDATE permissions. When you produce a remote database by running the database extraction utility, the GRANT CONSOLIDATE statement is executed automatically at the remote database.

Adaptive Server Anywhere example 

The following Adaptive Server Anywhere statement grants CONSOLIDATE permissions to the hq_user user ID, using the VIM e-mail system:

GRANT CONSOLIDATE TO hq_user
TYPE vim 
ADDRESS 'hq_address'

There is no SEND clause in this statement, so the default is used and messages will be sent to the consolidated database every time the Message Agent is run.

Adaptive Server Enterprise example 

The following Adaptive Server Enterprise statement grants CONSOLIDATE permissions to user hq_user:

exec sp_grant_consolidate 'hq_user', address
go

Top of page  Revoking REMOTE and CONSOLIDATE permissions

A user can be removed from a SQL Remote installation by revoking their REMOTE permissions. Revoking remote user permissions also drops any subscriptions for that user.

Revoking permissions from Sybase Central 

You can revoke REMOTE permissions on both Adaptive Server Enterprise and Adaptive Server Anywhere from Sybase Central.

   To revoke REMOTE permissions from Sybase Central :
  1. Open the SQL Remote folder.

  2. Open the Remote Users folder.

  3. Right-click the user whose permission you wish to revoke, and select Revoke Remote from the popup menu.

Revoking permissions in Adaptive Server Anywhere 

REMOTE and CONSOLIDATE permissions can be revoked from a user using the REVOKE statement. The following statement revokes REMOTE permission from user S_Beaulieu.

REVOKE REMOTE FROM S_Beaulieu

DBA authority is required to revoke REMOTE or CONSOLIDATE access.

Revoking permissions in Adaptive Server Enterprise 

REMOTE permissions can be revoked from a user using the sp_revoke_remote procedure. This procedure takes a single argument, which is the user ID of the user. The following statement revokes REMOTE permission from user S_Beaulieu.

exec sp_revoke_remote 'S_Beaulieu'
go

Top of page  Assigning permissions in multi-tier installations

Special considerations are needed for assigning permissions in multi-tier installations. The permissions in a three-level SQL Remote setup are summarized in the following diagrams. In each diagram one database is shaded; the diagram shows the permissions that need to be granted in that database for the user ID representing each of the other databases. The phrase "No permissions" means that the database is not granted any permissions in the shaded database.

The following picture shows SQL Remote permissions, as granted at the consolidated site of a three-tier installation.

The following picture shows SQL Remote permissions, as granted at an internal site of a three-tier installation.

The following picture shows SQL Remote permissions, as granted at an internal site of a three-tier installation.

Granting the appropriate PUBLISH and CONSOLIDATE permissions at remote databases is done automatically by the database extraction utility.

Top of page  

Collection Contents Index Management overview Using message types pdf/chap10.pdf