To back up the external Sybase database that is installed and running on a Linux server to a network location on a Linux machine, you need a local machine and a remote machine. The local machine is a Linux server with the external Sybase database installed. The remote machine is a Linux machine that has the network location to which you want to back up the database.
You can back up the database on a Linux machine by using any Linux share such as Samba share or an NFS share.
To back up the external Sybase database that is installed and running on a Linux server to a network location on a Linux machine by using Samba share:
Create a Samba share on the remote machine:
Create a user by entering the useradd user_name command at the command prompt.
Log into the remote machine with the user name you created in Step 1.a, and set the password by using the passwd specify_the_password command.
Create a directory to save the database backup.
For example, create a directory with the name backup.
Open the Samba server settings by running the yast2 samba-server command.
Click the Shares tab, then click Add to specify the share name and the path to the backup directory you created in Step 1.c.
For example, specify the share name as dbbackup.
Select the dbbackup share, click Edit, then add the following attributes:
create mask = 0640
force user = user_name_created_in_Step 1.a
guest ok = yes
public = yes
wide links = no
writeable = yes
Create a directory on the local machine.
For example, create a directory with the name zenworks_dbbackup in /root.
Mount the Samba share on the zenworks_dbbackup directory on the local machine by entering the following command at the command prompt:
mount -t smbfs //IP_address of the remote_machine/share_name -o username=user_name_specified_in_Step1a,password=password_ specified_in_Step_1b local_directory_name_with_complete_path_created_in_Step2
For example:
mount -t smbfs //IP_address of the remote_machine/dbbackup -o username=user_name_specified_in_Step1a,password=password_ specified_in_Step_1b /root/zenworks_dbbackup
Launch the DBISQL utility on the local machine. For more information, see Step 1 in the Backing Up the External Sybase Database on a Windows or Linux Server.
Decide whether you want to immediately back up the external Sybase database or to schedule the backup to run at a specific time. To back up the database immediately, continue with Step 5.a. To schedule the backup to run at a specific time, skip to Step 6.
Stop the ZENworks services on the ZENworks Servers in the Management Zone.
Execute the following command at the server prompt:
/opt/novell/zenworks/bin/novell-zenworks-configure -c Start
Enter the number next to the Stop action.
To immediately back up the external Sybase database to the network location on the remote machine, do one of the following:
Specify the following query in the SQL Statements section of the DBISQL utility:
BACKUP DATABASE DIRECTORY 'complete_path_of_the_backup_directory_on_database_server' TRANSACTION LOG TRUNCATE
For example, execute the following query to back up the database to the /root/zenworks_dbbackup directory:
BACKUP DATABASE DIRECTORY '/root/zenworks_dbbackup/' TRANSACTION LOG TRUNCATE
You must manually archive the complete path of the database backup location that you specify in the query because you need to specify it if you want to change the database backup location at a later time.
Manually copy zenworks_zone_name.db and zenworks_zone_name.log from the database server to a required location on the remote machine.
By default, the files are located in /var/opt/novell/zenworks/database/ on a Linux Sybase database server.
Click Execute SQL Statement(s).
Start the ZENworks services on the ZENworks Servers in the Management Zone .
Execute the following command at the server prompt:
/opt/novell/zenworks/bin/novell-zenworks-configure -c Start
Enter the number next to the Start action.
To schedule the backup to run at a specific time every day or on specific days of a month:
Execute the following query by specifying it in the SQL Statements section:
CREATE EVENT backup_schedule_name
SCHEDULE
START TIME specify_the_schedule
HANDLER
BEGIN
BACKUP DATABASE DIRECTORY 'complete_path_of_the_backup_directory_on_database_server'
TRANSACTION LOG TRUNCATE
END;
While creating a database backup event, use the following guidelines:
The backup schedule name that you specify must be unique.
You must manually archive the backup schedule that you specify in the query because you need to specify it if you want to change the database schedule at a later time.
Click Execute SQL Statement(s).
Examples:
To back up the database at a 1:00 A.M. everyday to the /root/zenworks_dbbackup directory on Linux, execute the following query:
CREATE EVENT ZENDBbackup
SCHEDULE
START TIME '1:00 AM' EVERY 24 HOURS
HANDLER
BEGIN
BACKUP DATABASE DIRECTORY '/root/zenworks_dbbackup/'
TRANSACTION LOG TRUNCATE
END;
To back up the database at a 1:00 a.m. on the first, second, third, and fourth day of the month to the /root/zenworks_dbbackup directory on Linux, execute the following query:
CREATE EVENT ZENDBbackup
SCHEDULE
START TIME '1:00 AM' EVERY 24 HOURS ON (1,2,3,4)
HANDLER
BEGIN
BACKUP DATABASE DIRECTORY '/root/zenworks_dbbackup/'
TRANSACTION LOG TRUNCATE
END;
To back up the database to the /root/zenworks_dbbackup/day_of_the_week directory on Linux, execute the following query:
CREATE EVENT ZENDBbackup
SCHEDULE
START TIME '1:00 AM' EVERY 24 HOURS
HANDLER
BEGIN
DECLARE backupDir varchar(256);
DECLARE backup_stmt varchar(512);
SET backupDir = DAYNAME(now());
SET backup_stmt = 'BACKUP DATABASE DIRECTORY '|| '''/root/zenworks_dbbackup//' || backupDir || ''''|| ' TRANSACTION LOG TRUNCATE';
EXECUTE IMMEDIATE backup_stmt;
END;
According to the backup schedule, zenworks_zone_name.db and zenworks_zone_name.log are created in the network location on the remote machine (/root/zenworks_dbbackup). The backed-up database is stored in zenworks_zone_name.db. The result of the database backup is logged in zenworks_zone_name.log.
If you want to change the database backup location or the backup schedule at a later time, see Changing the Backup Schedule and Location of the External Sybase Database Subsequent to the Initial Backup.