Install ASE 12.5 for LINUX

Source: Internet
Author: User
Tags sybase database dsquery

For details, refer to sybase Installation Guide (Chinese version) Adaptive Server Enterprise
12.5 Linux/Intel.
I have referenced several documents on the Internet. Thank you!
(1) Log On As root:
Create sybase users and user groups (useradd, groupadd or linuxconf)
Mount CDROM
# Mount/mnt/cdrom (# mount-t iso9660/dev/cdrom/mnt/cdrom)
Note: before installing the Sybase Database, first back up/etc/ld. so. conf:
Cp/etc/ld. so. conf/etc/ld. so. conf. sybase
Install SYBASE
(1) Select the character mode (shell can be used)
# Rpm-ivh/mnt/cdrom/RPMS/sybase-common-12.5-3.i386.rpm
# Rpm-ivh/mnt/cdrom/RPMS/sybase-ase-12.5-3.i386.rpm
# Rpm-ivh/mnt/cdrom/RPMS/sybase-chinese-12.5-3.i386.rpm
# Rpm-ivh/mnt/cdrom/RPMS/sybase-monserver-12.5-3.i386.rpm
# Rpm-ivh/mnt/cdrom/RPMS/sybase-openclient-12.5-3.i386.rpm
# Rpm-ivh/mnt/cdrom/RPMS/sybase-efts-12.5-3.i386.rpm
# Rpm-ivh/mnt/cdrom/RPMS/sybase-esql-12.5-3.i386.rpm
# Rpm-ivh/mnt/cdrom/RPMS/sybase-sqlremote-7.0.2-1.i386.rpm
(2) Change sybase User Permissions
After the installation, SYBASE automatically sets the sybase user account and environment variables. You only need to change the password of the sybase user;
(3) Modify sybase's/tmp directory access
# Chmod o + wx/tmp
To enable access to the/var/lock/subsys/sybase directory during sybase restart
# Chmod o + rwx/var/lock/subsys
(4) Modify sybase user environment variables
Edit the user logon file:
For example, edit the bash_profile file as a bash user.
$ Vi. bash_profile
DSQUERY = www
LANG = us_english
Export LD_ASSUME_KERNEL = 2.4.19
Export THREADS_FLAG = native
Add $ SYBASE/install to PATH
(5) preparations before the ASE Server is created
Default Value of the operating system shared memory, 32 MB for most Linux versions.
The minimum Adaptive Server requirement is 64 MB. The maximum value of each Request Heap needs to be optimized.
The size of the shared memory segment. Go to the/proc directory. Check the available operating system's
Size.
# Ipcs-lm | grep 'max seg size'
Max seg size (kbytes) = 32768
Select a new size for the OS Shared Memory parameter. For example, to change the shared memory
It is 512 MB. You can enter:
# Echo '2017*512*1024 '| bc>
Proc/sys/kernel/shmmax
Verify whether the change takes effect:
# 'Pcs-lm | grep' max seg size'
Max seg size (kbytes) = 524288
To avoid this change after each restart
Modify the/etc/sysctl. conf file, and add the number of kernel. shmmax = 128*1024*1024 (128 MB) memory (in bytes) to the line after the meeting ).
(6) before installing the Sybase Database, first back up/etc/ld. so. conf:
Cp/etc/ld. so. conf/etc/ld. so. conf. sybase
For more information about the cause, see
(7) SYBASE Registration
Use sybase User Login
$/Opt/Sybase-12.5/SYSAM/bin/startd. sh $ SYBASE/SYSAM
$ Cd/opt/Sybase-12.5/SYSAM
$ Lmgr
Input:
• Serial number
• Function name
• Function count
• Software Version
• Authorization code
The authentication information provided in the Adaptive Server software package is printed in the "Sybase Software Asset
Production management certification.
After entering all the licenses, click "finish "!
(The authentication information in windows2k should also be used in sybase12.5 for linux. You can try it)
Check whether the software is running:
When the lmgrd daemon is started, it automatically starts the SYBASE daemon. To verify license
Whether the certificate management software runs on the system. Usage:
$ SYBASE/SYSAM-1_0/bin/lmutil lmstat-c
Before continuing to install or start the Adaptive Server, check that lmgrd and SYBASE are running,
That is, "up ".
Note: To ensure that the SySAM (Sybase Software Asset Manager) license mechanism is enabled at system startup
Add:
/Opt/Sybase-12.5/SYSAM/bin/startd. sh/opt/Sybase-12.5/SYSAM
(2) install ASE12.5
Log in with sybase user (after restarting the machine)
(1) character selection
-- Edit the source file (/init/sample_resourde_files/srvbuild. adaptive_server.rs,
/Init/sample_resourde_files/srvbuild. backup_server.rs)
Copy the source file to the backup directory/usr:
$ Cp/init/sample_resourde_files/srvbuild. adaptive_server.rs/usr/ase. rs
$ Cp/init/sample_resourde_files/srvbuild. adaptive_server.rs/usr/backup. rs
Edit ase. rs, backup. rs
-- Run the source file
$ D/opt/sybase-12.5/bin
$ Srvbuildres-r/opt/sybase-12.5/usr/ase. rs
$ Srvbuildres-r/opt/sybase-12.5/usr/backup. rs
  
(2) Use the asecfg tool to configure the ASE product in X-Windows.
1. Use the sybase user to log on to X-Windows and execute the sybase installation directory (/opt/sybase-12.5/bin /)
# Asecfg
Select Build New Servers.
Note: When running asecfg, an error message may appear:
Error occurred during initialization of VM
Unable to load native library:
/Opt/Sybase-12.5/jre/lib/i386
/Libjava. so symbol _ libc_wait, version GLIBC_2.0 not
Defined in file libc. so.6 with link time reference
To solve the _ libc_wait symbol problem, download the patch from the http://metalink.oracle.com/
P3006854 _ 9204_LINUX.zip.
To apply this patch, run:
$ Su-root
# Unzip p3006854_9204_LINUX.zip
# Cd 1, 3006854
[Root @ www 3006854] # ls
README.txt rhel3_pre_install.sh
[Root @ www 3006854] # sh rhel3_pre_install.sh
Or
# Rpm-ivh compat-libcwait-2.0-2.i386.rpm
2. In the srvbuild window, select the Server type to install. Select all four servers.
3. Name the Server. I named the Adaptive Server www. Correspondingly, the Backup Server automatically named www_back, the Monitor Server named www_mon, And the XP Server named www_XP. Click OK to go to the configuration process of each Server.
4. Configure the Adaptive Server. Enter or select the following content:
Master device path (master device path): $ SYBASE/data/Master. dat
Master device size (MB) (Master device size): 100
Master database size (MB) (Master database size): 60
Sybsystemprocs device path (path of the device in the system stored procedure): $ SYBASE/data/systemprocs. dat
Sybsystemprocs device size (MB) (system stored procedure device size): 60
Sybsystemprocs database size (MB) (system stored procedure database size): 60
Error log path (Error log path):/opt/sybase-12.5/install/www. log
Transport type (Transport protocol type): tcp
Host name (Host name): 192.168.9.1
Port number (listening Port number): 5000
Click OK to go to the next configuration process.
5. Configure the Backup Server. Enter or select the following content:
Error log path:/opt/sybase-12.5/install/www_back.log
Tape configuration file:/opt/sybase-12.5/backup_tape.cfg
Language: (not required)
Character set :( do not fill in)
Maximum number of network connections: 25
Maximum number of server connections: 100
Transport type: tcp
Host name: 192.168.9.1
Port number: 5001
Click OK to go to the next configuration process.
6. Configure the Monitor Server. Enter or select the following content:
Maximum number of connections: 5
Error log path:/opt/sybase-12.5/install/www_mon.log
Configuration file path:/opt/sybase-12.5/install/www_mon.cfg
Share memory directory:/opt/sybase-12.5
Transport type: tcp
Host name: 192.168.9.1
Port number: 5002
Click OK to go to the next configuration process.
7. Configure the XP Server. Enter or select the following content:
Transport type: tcp
Host name: 192.168.9.1
Port number: 5003
Click "Build Server" to create the Server. A window is displayed, showing the creation process. If the following similar information is displayed, the Server is successfully created:
......
Server www was successfully created.
Done.
8. Several things to do after the installation is successful. First, Log On As a sybase user in Linux Console mode.
① Check whether the Server is running. Run the showserver or rc. SYBASE status command under $ sybase/install/($ SYBASE indicates the installation directory of sybase). You can see several sybase-related processes in the system. Or use the isql-Usa-P-Swww command under $ SYBASE/bin/to log on to the Server. You should be able to see the isql prompt "1>" and then type exit to exit.
② Set the sa account password. After the Server is installed, the system automatically creates the sa user, that is, the system administrator, which has the maximum power to the entire system. However, the sa password is blank and must be changed immediately.
$ SYBASE/bin/isql-Usa-P-Swww
1> sp_password null, New Password
2> go
③ Disable the default status of the master device. Otherwise, your database will be installed on the master device.
$ SYBASE/bin/isql-Usa-Swww
Password: (enter a new Password)
1> sp_diskdefault master, defaultoff
2> go
④ The default host name stored in the rh hosts file corresponds to 127.0.0.1, which will cause the problem that sybase users cannot connect to the network. You only need to add
Hostname 192.168.9.1. Remember not to change it when sybase is running! Also, check whether the sybase port is enabled for firewall (use setup and iptable to change)
⑤ Some users always say that isql must contain the-S parameter in rh because DSQUERY is not set. Only export DSQUERY = www can be added to. profile!
9. Start the database manually
$ SYBASE/install/startserver-f $ SYBASE/install/RUN_www>/dev/null
$ SYBASE/install/startserver-f $ SYBASE/install/RUN_www_back>/dev/null
Or $ SYBASE/install/rc. sybase start
Stop Database
$ SYBASE/install/rc. sybase stop
View database status
$ SYBASE/install/rc. sybase status
Note: In Red Hat LINUX 9.0 or Fedora core 4, because I installed the default Chinese (root user), and the language is only Chinese zh_CN.GB18030/UTF-8, so that the SYBASE Database can not start, the prompt environment variable langue = zh_CN.GB18030 or zh_CN.UTF-8 in $ SYBASE/locales. dat does not exist. I added a line in locales. dat and made corresponding changes.
[Linux]
Locale = zh_CN.GB18030, us_english, cp850
Locale = zh_CN.UTF-8, us_english, cp850
Locale = ENGLISH, us_english, cp850
Locale = en, us_english, cp850
Locale = en_US, us_english, cp850
Locale = us_EN, us_english, cp850
Locale = C, us_english, cp850
Locale = default, us_english, cp850
10. Set the language, characters, and sorting
After the installation is complete, return to the sybsetup Main Window
Select Localize Adaptive Server, select the Adaptive Server name, and press OK to continue
Select Us English as the installation language,
The character set is Code Page 850,
The sorting method is Altername dictionary sorting with case and accent insensiti.pdf
Or
Run $ SYBASE/bin/sqlloc to set
Ages = "us_english"
Code = "cp850"
Sort order = "Altername dictionary sorting with case and accent insensiti.pdf"
Set c: \ sybase \ locales. dat on the client.
[Linux] changing iso_1 to cp850 at the top and bottom lines can display Chinese characters on the client.
11. Edit and modify/opt/sybase-12.5/SYBSERVER. cfg
(SYBSERVER is the SYBASE server name)
Max network packet size = 2048
Default network packet size = 1024
Number of user connections = 100
Number of open indexes = 2000
Number of open objects = 1000
Number of locks = 150000
Modify sybase Configuration
Log in with isql
Sp_configure "max mem", 100 M
Go
Sp_cacheconfig "default data cache", "60 m"
Go
12. Connect to the Adaptive Server through Sybase Central
Sybase Central provides a graphical user interface where Adaptive Server management can be executed
Manage tasks. The Sybase Central interface is very similar to Windows resource manager. All services
The hierarchy list of the server is displayed in the left pane, and the details of the selected server are displayed in the right pane.
To select a server, click it in the left pane.
To start Sybase Central:
$ SYBASE/sybcent32/scjview
In the left pane, click the server to connect.
In the "login" window, enter the user name and password of the system administrator.
You must log on as a system administrator.
Note: the error message for running bash-3.00 $./scjview is as follows:
\ NStarting Sybase Central Java Edition (displaying to)... \ n
/Opt/sybase-12.5/shared-1_0/jre-1_1/lib/i686/green_threads/libzip. so: symbol errno, version GLIBC_2.0 not defined in file libc. so.6 with link time reference (libzip. so)
Unable to initialize threads: cannot find class java/lang/Thread
Cocould not create Java VM
Mv: cannot stat '/tmp/scj_7784.log': No such file or directory
\ N
The following error (s) occured while running Sybase Central
-----------------------------------------------------------
Cat:/tmp/scj_error.log: No such file or directory
\ NError (s) have been written to the file:/tmp/scj_error.log \ n
Solution: Add vi $ SYBASE/. profile:
# If the core is 2. 6. * or above, set LD_ASSUME_KERNEL to 2.4.19.
Export LD_ASSUME_KERNEL = 2.4.19
Export THREADS_FLAG = native
After./scjview:
Register ase plug-in: $ SYBASE/ASEP-1_0/ASEPlugin. jar, you can manage the database, you can configure and create a database!
13. Create a database
① Create a database Device: the database and transaction logs of Sybase are created on the database Device, which can be physical disks, disk partitions, or operating system files. Use the disk init command to create a database device, use the diskdefault command to specify the default database device, and specify multiple default database devices. If no database device is specified when a database is created, it is created on the default database device. For example, run the following command:
$ SYBASE/bin/isql-Usa-Swww
Password: (enter the Password)
1> disk init name = "userdev", & the device name is userdev
2> physname = "/db/sybsystem/userdev. dat", & the device file name is userdev. dat.
3> vdevno = 3, & amp; device number 3
4> size = 51200 & size: 100 M (51200 blocks, 1 block = 2 k)
5> go
1> sp_diskdefault userdev, defaulton & specify as the default database Device
2> go
② Database creation example:
1> disk init
2> name = "branch60 ",
3> physname = "/opt/sybase-12.5/data/branch60.dat ",
4> vdevno = 4, size = 102400 (200 M)
5> go
-----------------
1> disk init
2> name = "branch60_log ",
3> physname = "/opt/sybase-12.5/data/branch60_log.dat ",
4> vdevno = 5, size = 51200 (100 M)
5> go
---------------------------------------
1> create database branch60
2> on branch60 = 200
3> log on branch60_log = 100
4> go
Create database: allocating 102400 logical pages (200.0 megabytes) on disk
'Branch60 '.
Create database: allocating 51200 logical pages (100.0 megabytes) on disk
'Branch60 _ log '.
(3) install the syntax database and example Database
Create a database device for storing the syntax database and sample database. The size is 10 MB and the device is set to the default status.
$ SYBASE/bin/isql-Usa-Swww
Password: (enter the Password)
1> disk init name = "sybsyntaxdev ",
2> physname = "/db/sybsystem/sybsyntaxdev. dat ",
3> vdevno = 3, size = 5120
4> go
1> sp_diskdefault sybsyntaxdev, defaulton
2> go
1. Install the sybsyntax syntax database. This is installed through the script file $ SYBASE/scripts/ins_syn_ SQL. However, you need to modify ins_syn_ SQL. Remove the statement that begins with "create database sybsyntax" and run the following command:
$ SYBASE/bin/isql-Usa-P password-Swww-I $ SYBASE/scripts/ins_syn_ SQL
After the syntax database is installed, you can use the system stored procedure sp_syntax to query the help of the Transact-SQL language, system stored procedure, and Sybase tool. For example, to query the usage of the select command:
$ SYBASE/bin/isql-Usa-Swww
Password: (enter the Password)
1> sp_syntax "select"
2> go
2. Install the pubs2 and pubs3 sample databases. The example in the technical document is from the example database. Run the following command:
$ SYBASE/bin/isql-Usa-P password-Swww-I $ SYBASE/scripts/installpubs2
$ SYBASE/bin/isql-Usa-P password-Swww-I $ SYBASE/scripts/installpubs3
(4) install the ASE patch
According to sybase, ebf10492.tar.gz corrected some of the latest known problems in ASE12.5.
1. Shut down the Server first.
$ SYBASE/install/rc. sybase stop or
$ SYBASE/bin/isql-Usa-Swww
Password: (enter the Password)
1> shutdown www_back & close Backup Server
2> go
1> shutdown & close Adaptive Server
2> go
$ SYBASE/bin/isql-Usa-P password-Swww_mon
1> sms_shutdown & disable Monitor Server
2> go
2. Log On As A root user in Linux Console mode.
# Mkdir/tmp/ebf & create a temporary directory for storing Patches
# Mount-t iso9660/dev/cdrom/mnt/cdrom & load the disc or copy it to the hard disk
# Cp/mnt/cdrom/EBF10492.tgz/tmp/ebf & copy the patch to the temporary directory
# Cd/tmp/ebf
# Tar-zxf EBF10492.tar.gz
# Rpm-ivh/tmp/ebf/ebf10492/RPMS/sybase-SWR-10492-1.i386.rpm
Log out as the root user and Log On As the sybase user. Because the database cannot be started after the patch is installed, run $ SYBASE/install/sybinstalll. sh to reset the read and write permissions of the sybase user on $ SYBASE.
Create a shell script ebfsetup (perform the following script according to the ebf description file)
#! /Bin/sh
# Filename: ebfsetup
# Echo "setup sybase ebf10492.tar.gz ..."
# Rpm-ivh/tmp/ebf/ebf10492/RPMS/*. rpm
Echo "start sybase"
$ SYBASE/install/rc. sybase start
Echo "sybase status"
Rc. sybase status
Echo "sybase install script... 1"
Isql-Usa-Ppassword-Stimes-n-I $ SYBASE/scripts/installmaster-o m.txt
Echo "sybase install script... 2"
Isql-Usa-Ppassword-Stimes-n-I $ SYBASE/scripts/installcommit-o commit.txt
Echo "sybase install script... 3"
Isql-Usa-Ppassword-Stimes-n-I $ SYBASE/scripts/installdbccdb-o db.txt
Echo "sybase install script... 4"
Isql-Usa-Ppassword-Stimes-n-I $ SYBASE/scripts/installsecurity-o security.txt
Echo "sybase install script... 5"
Isql-Usa-Ppassword-Stimes-n-I $ SYBASE/scripts/instmsgs. ebf-o instmsgs.txt
Echo "sybase install script. finish .... "
3. Log On As a sybase user and start the Adaptive Server.
$ SYBASE/install/rc. sybase start or
$ SYBASE/install/startserver-f $ SYBASE/install/RUN_www>/dev/null
$ SYBASE/install/startserver-f $ SYBASE/install/RUN_www_back>/dev/null
(5)
1. automatically load the Sybase Database at startup
To enable Sybase SQL Server, you must log on to the system as a sybase user,
To enable the linux system to load Sybase in the background at startup, we can
$ SYBASE/install/sybinstall. sh
# Chkconfig sybase on
In/etc/rc5.d/S85sybase restart/etc/init. d/Sybase
Equivalent: ln-sf/etc/init. d/sybase/etc/rc5.d/S85sybase
Set it to auto-start in the service.
2. Automatically uninstall the Sybase database upon Shutdown
To ensure the normal operation of Sybase, you must end the service process of Sybase SQL Server every time you shut down the linux system.
# After chkconfig sybase on, it automatically goes to/etc/rc0.d/K15sybase restart/etc/init. d/sybase
3. Sybase Database Backup skills
Generally, the Sybase Database is backed up using tapes as media. However, there is a better way to back up the database to the hard disk and compress the database to the tape to facilitate recovery, A backup copy is added, saving the backup time. The specific implementation steps are as follows:
(1) create a disk backup device
Run isql, log on to the Sybase system with sa, and run the following content:
Sp_addumpdevice "disk", disk_bkupdevice,/tmp/dumpdb, 2
Go
In this way, a backup device named "disk_bkupdevice" is created in Sybase, which corresponds to the/tmp/dumpdb file in the Unix system.
(2) create a backup user
Enter the linux system as root, create backupdb, and belong to the sybase group.
(3) Modify Related Files
Add the following statement to/home/backupdb/. bash_profile:
SYBASE =/opt/sybase-12.5
DSQUERY = www
PATH = $ PATH: $ SYBASE/bin
Export SYBASE DSQUERY PATH
Rm/tmp/backupdb. Z
Echo "start backing up SYBASE database... "
Isql-Usa-Ppassword-ibackup. SQL>/tmp/dbbackup. log
Echo "hard disk backup is complete. compressing the backup data file... "
Compress/tmp/backupdb
Echo "backing up compressed data into tape... "
Tar c8v/tmp/backupdb. Z
Echo "backup complete !"
"PASSWORD" is the sa user's PASSWORD. backup. SQL is a simple text file with the following content:
Dump database db_main to disk_bkupdevice
Go
The backup execution log is recorded in/tmp/dbbackup. log. Of course, the system administrator can also view $ SYBASE/install/backup. log
Obtain the backup log.
This backup method requires that the hard disk space be large enough, which requires the system administrator to pay special attention when creating partitions for linux.
(4) There are two other methods:
(A) bcp backup
The backup directory is/export.
$ SYBASE/bin/bcp databasename .. tablename-out/export/tablename.txt-Usa-Ppassword-Swww-c
(B) dump backup
Isql-Usa-Ppassword-Swww-ibackup. SQL>/dev/null
Backup. SQL:
Dump tran databasename to "/export/db_log.dat" with {no_log | truncate_only | no_truncate}
Go
Dump database databasename to "/export/db_1.1"
Stripe on "/export/db_1.2"
Stripe on "/export/db_1.3"
Go
Exit
About timed backup
Crontab can be written as follows:
00 23 ***/opt/Sybase-12.5/ASE-12_5/bin/DUMPDB. sh> // opt/Sybase-12.5/ASE-12_0/install/DUMPDB. out
It doesn't matter if you put it there. An example of dumpdb. sh is as follows:
# Rh linux
#! /Bin/sh
Export SYBASE_FTS = FTS
Export SYBASE_OCS = OCS
Export SYBASE_ASE = ASE
Export SYBASE_SYSAM = SYSAM
Export LM_LICENSE_FILE =$ {SYBASE}/$ {SYBASE_SYSAM}/licenses/license. dat: $ LM_LICENSE_FILE
Export LD_LIBRARY_PATH =$ {SYBASE}/$ {SYBASE_ASE}/lib: $ {SYBASE}/$ {SYBASE_FTS}/lib: $ {SYBASE}/$ {SYBASE_OCS}/lib: $ {SYBASE}/SQLRemote/lib: $ LD_LIBRARY_PATH
Export PATH = "$ {SYBASE}/$ {SYBASE_ASE}/bin :$ {SYBASE}/$ {SYBASE_ASE}/install :$ {SYBASE}/$ {SYBASE_OCS}/bin: $ {SYBASE}/$ {SYBASE_SYSAM}/bin :$ {SYBASE}/shared/jre/bin: $ PATH"
Echo "start backing up SYBASE database... "
Su-sybase-c "isql-Swww-Usa-P" dump database branch60 to "/export/dump.01"
Stripe on "/export/dump.02"
Stripe on "/export/dump.03"
Go
!
Echo "hard disk backup is complete. compressing the backup data file... "
Compress/export/dump *
Echo "backup complete !"
Here is a typical script for full backup!
#! /Bin/sh
#*************************************** **********************************
# For full backup after excuted dbcc operation
#*************************************** **********************************
Export SYBASE_FTS = FTS
Export SYBASE_OCS = OCS
Export SYBASE_ASE = ASE
Export SYBASE_SYSAM = SYSAM
LM_LICENSE_FILE =$ {SYBASE}/$ {SYBASE_SYSAM}/licenses/license. dat: $ LM_LICENSE_FILE
Export LM_LICENSE_FILE
LD_LIBRARY_PATH =$ {SYBASE}/$ {SYBASE_ASE}/lib :$ {SYBASE}/$ {SYBASE_FTS}/lib :$ {SYBASE}/$ {SYBASE_OCS}/lib: $ {SYBASE}/SQLRemote/lib: $ LD_LIBRARY_PATH
Export LD_LIBRARY_PATH
PATH = "$ {SYBASE}/$ {SYBASE_ASE}/bin: $ {SYBASE}/$ {SYBASE_ASE}/install :$ {SYBASE}/$ {SYBASE_OCS}/bin: $ {SYBASE}/$ {SYBASE_SYSAM}/bin :$ {SYBASE}/shared/jre/bin: $ PATH"
Export PATH
Dump = "www"
Ymd = 'date + % y % m % d'
Bk_db = "branch60"
Cd/export
# Mkdir $ ymd
LOG = "/export/backup/$ ymd"
# Mkdir $ LOG
# Touch $ LOG/backup. log
Echo $ ymd> $ LOG/backup. log
Echo "\ n11 ************************"> $ LOG/backup. log
Echo "dbcc Check database $ bk_db..."> $ LOG/backup. log
D1 = 'date'
Su-sybase-c "isql-Swww-Usa-P" $ LOG/dbcc-$ ymd. log 2> & 1
Go
Dbcc checkdb ($ bk_db)
Go
DBCC
Echo "dbcc complete !"
D1 = 'date'
Echo $ d1, 'date'> $ LOG/backup. log
Echo "\ n22 ************************"> $ LOG/backup. log
D1 = 'date'
Dump_file = "/export/backup/$ dump-$ ymd. dat"
Echo "Dump database $ bk_db to" $ dump_file >>$ LOG/backup. log
Touch $ LOG/dump-$ ymd. log
Echo "start backing up SYBASE database... "
Su-sybase-c "isql-Swww-Usa-P" $ LOG/dump-$ ymd. log 2> & 1
Dump database $ bk_db to "$ dump_file"
Go
DUMP
# Dump database yourdatabasename to "/export/backup/dump.01"
# Stripe on "/export/backup/dump.02"
# Stripe on "/export/backup/dump.03"
Echo $ d1, 'date'> $ LOG/backup. log
Echo "\ n33 ************************"> $ LOG/backup. log
Echo "backup complete !"
Use it after debugging based on your system!
The script used to back up logs is similar to this one. Just make a slight change based on sybase's syntax!
(5) restore the Backup Directory to/export
① Bcp restore $ SYBASE/bin/bcp databasename .. tablename-in/export/tablename.txt-Usa-Ppassword-Swww-c-B
② Load recovery
$ SYBASE/bin/isql-Usa-Ppassword-Swww-irestore. SQL>/dev/null
Restore. SQL:
Load database databasename from "/export/db_1.1"
Stripe on "/export/db_1.2"
Stripe on "/export/db_1.3"
Go
Online database databasename
Go
Checkpoint
Go
Sp_dboption databasename, 'single user', false
Go
Use databasename
Go
Checkpoint
Go
Dbcc checkdb (databasename)
Go
Note:
Generation of Bcp Script: select. SQL
Set nocount on
Use pubs2
Go
Select "bcp" + databasename + ".. "+ name +" "+"-out "+" "+"/path/commandid name1_0000.txt "+"-Usa-Ppassword-Swww-c "from sysobjects where type = 'U'
Or
Select "bcp" + databasename + ".. "+ name +" "+"-in "+" "+"/path/commandid name1_0000.txt "+"-Usa-Ppassword-Swww-c-B "from sysobjects where type =' u'
Isql-Usa-P-Swww-B-iselect. SQL-o bcpout
Chmod + x bcpout

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.