When you invoke the mra_admin utility with the -r option, the utility first validates the specified resource file, as described in “Validating a resource file”, except:
If the Mirror Replication Agent primary database user login does
not exist in the primary data server, the utility creates it, if
specified in the resource file (create_pds_username=yes
).
If the Mirror Replication Agent primary database user login does exist in the primary data server, and the resource file specifies that it should be created, the utility returns an error message and does not create the instance. (This error would be caught in the validation process described in “Validating a resource file”.)
If a RepAgent thread is running or enabled in the
primary database, the utility stops the RepAgent thread and disables
it, if specified in the resource file (disable_rat=yes
).
If a RepAgent thread is not enabled or running in the primary database, and the resource file specifies that it should be stopped and disabled, the utility returns an error message and does not create the instance.
If the resource file specifies that the new Mirror Replication Agent instance
should be initialized (initialize_instance=yes
),
then:
The Mirror Replication Agent primary database user
login must either exist in the primary data server or be created
by the mra_admin utility (create_pds_username=yes
),
and
The RepAgent thread in the primary database must
either be not running and disabled or be disabled
by the mra_admin utility (disable_rat=yes
).
Otherwise, the utility returns an error message and does not create the instance.
After validating the resource file successfully, the mra_admin utility does the following:
Creates and configures a Mirror Replication Agent instance, based on the contents of the specified resource file
Starts the new Mirror Replication Agent instance, if specified in the resource file
Initializes the new Mirror Replication Agent instance, if specified in the resource file
When it initializes a Mirror Replication Agent instance, mra_admin quiesces
the primary database. See the Mirror Activator Administration Guide for
more information about quiescing the primary database.
Records mirror log device information in the log device repository, if specified in the resource file
The utility also returns information about the instance created and the result.
If instance creation fails, the mra_admin utility returns an error message and information about the failure.
Sybase recommends that you validate a new resource file before you use it
to create a Mirror Replication Agent instance. See “Validating a resource file” for more information.
To create a Mirror Replication Agent instance
Invoke the mra_admin utility, specifying the -r option and the name of the resource file:
mra_admin -r res_file
where res_file is the name of the resource file.
For example, if the resource file is named pubs2.rs, enter the following at the command prompt:
mra_admin -r pubs2.rs
Results are returned as either:
Admin
processing completed
or
Admin processing completed with
errors
If the instance creation is successful, you can begin using the new Mirror Replication Agent instance.
If the instance creation fails, you may have to do the following:
Drop the Mirror Replication Agent user from the primary database, and drop the login from the primary data server.
Delete all files and subdirectories in the instance directory, and delete the instance directory in the Mirror Replication Agent installation directory.
Edit the resource file to correct the appropriate values.
If the instance creation fails, use the following recovery
procedure before you attempt to create the
instance again.
To recover from instance creation errors
If the resource file does not specify that the instance user login be created in the primary data server, skip this step and continue with step 2.
If the resource file specifies that the instance user login
be created in the primary data server (that is, create_pds_username=yes
),
then:
Check the primary database to determine if the instance user was added:
sp_helpuser pds_username
where pds_username is the name of the instance user in the primary database.
If the instance user was added to the primary database, skip step 1b and go to step 1c.
If the instance user was not added to the primary database, go to step 1b.
Check the primary data server to determine if the instance login was created:
sp_displaylogin pds_username
where pds_username is the name of the instance login in the primary data server.
If the instance login was created in the primary data server, continue with step 1c.
If the instance login was not created in the primary data server, skip step 1c and go to step 2.
Edit the resource file to specify that the instance user login should not be created in the primary data server:
create_pds_username=no
If the Mirror Replication Agent primary database user login is successfully
created before the instance creation fails, you must either:
Edit the resource file to set the value of the create_pds_username parameter to no, or
Log in to the primary data server and drop the instance login (and drop the instance user from the primary database, if necessary).
Check the Mirror Replication Agent base directory on the Mirror Replication Agent host to see if a new instance directory was created. The Mirror Replication Agent base directory is:
%SYBASE%\MRA-12_6
where %SYBASE% is the Mirror Replication Agent installation directory.
If you do not find a new instance directory in the Mirror Replication Agent base directory, skip step 3 and go to step 4.
If you find a new instance directory in the Mirror Replication Agent base directory, continue with step 3.
To delete the new instance directory, you have two options:
Use the mra_admin utility to delete the instance:
mra_admin -d inst_name
where inst_name is the name of the instance you want to delete.
or
Use operating system commands to delete all of the files and subdirectories in the new instance directory, and then delete the new instance directory.
Review the error messages to find the cause of the instance creation failure, and if necessary, edit the resource file to correct the appropriate values.
After editing the resource file, use mra_admin to validate the resource file:
mra_admin -vr res_file
where res_file is the name of the resource file.
See “Validating a resource file” for more information.
After you complete the recovery procedure, you can retry creating the Mirror Replication Agent instance.