Document one: Sybase is pretty good at today's corporate database applications, and it can be easily applied to Windows systems and other operating systems, such as Linux,unix. Compared to the limitations of SQL Server only for Windows operating systems, Sybase's cross-platform nature makes her more popular with developers. Since many companies use Sybase as a carrier for database applications, how to keep the database secure. Today you will be briefed by IT168 readers on how to back up and restore the Sybase database. First, Sybase database characteristics: But because Sybase database centralized data management, its database server one end of the data is relatively centralized, database backup and recovery work is very important. In the actual day-to-day maintenance work, we have summed up the following Sybase database backup and Recovery methods. Here to do a brief introduction, I hope that the network administrator can be based on their own actual situation to take different methods of backup and recovery.Second, the network environment and practical methods:Of course, any operation has a graphical interface and command line mode, although the graphical interface is easy to start, but the operation is not as fast as the command line. To get a clear picture of backup and recovery, we can also use the dump command to back up the database and transaction logs, while the Restore database and transaction log use the load command. The system performs a checkpoint when the database is dumped, that is, the logs and data are copied from the buffer to the hard disk, the allocated pages (logs and data) are copied to the dump device, and SQL Server sends a backup of the A list of all pages that have been modified by operations that are rarely written to the log (such as BCP). Backup server dumps these pages. SQL Server then instructs backup server to transfer all log pages that have been written during the reserve period. The last backup captures the state at nearly the end of the backup. Knowing the work step, we need to understand the specific operation instructions. DUMP TRANSACTION database_name to Dump_device
[WITH Truncate_only | with No_log | with No_truncate] (1) The syntax for loading the database is:
Load database database_name from file_name
(2) The syntax for loading the transaction log is:
Load transaction database_name from file_name
(3) Database recovery:
1>load db_name Frome file_name
2>go uses the Sybase graphical Interface System Management tool (Sybase) to select and generate DDL files for the related content under the database that needs to be backed up, including database devices, logins, and so on. When the total number of tables and other database objects in the database is less than 255, you can generate a DDL file directly for the entire database. Note: Multiple DDL files should be generated in batches when the total is greater than 255. The DDL files generated above can be recovered by using the Sybase graphical Interface System Management tool (Sybase Advantage) and then clicking "Excute" to create a database when the database structure is restored. Note: When a generated DDL file or SQL file is opened in advantage, more than 3000 lines may not be executed, and the isql command should be used in the operating system command-line mode. Its command format is
isql Uusername ppassword–i D11
For example, when a Isql-usa-ssybase-ixxx.sql (DLL) runs the. bat batch file generated above on the operating system command-line, the records in all user tables of the database are automatically placed in several operating system files with the same name as the user table (with an. out extension). On the basis of creating a good database structure, the above batch file "out" all modified to "in", the implementation of the modified batch file, copy the data into the user table, so as to achieve the recovery of data records.
Summary: The primary task of database backup and recovery is to make a secure copy of the data in order to effectively prevent data loss in the event of a failure. Therefore, in the actual application, should be based on specific circumstances, to develop a realistic backup and recovery program, to determine the extent of the data recoverability in a variety of fault situations to meet the needs of the application, so as to continuously improve the backup and recovery program. With isql,
Load database dbname from "D:/gfzx.dmp"
Go
Online database dbname
Go 1, build the equipment for the database to be restored: In SQL Central, expand the corresponding database service node--database devices--add DB Device, set up the corresponding equipment. The device space can be increased appropriately.
2, in the corresponding equipment to establish a database: In SQL Central, expand the corresponding database service node--databases--add DB, enter the database name, select the database equipment just built, according to the default option until OK, The system automatically allocates the device space to the database to be created.
3. Restore the database: In SQL Central, expand the corresponding database service node--databases--find the database created in the second step, right-click the database select Restore, select the restored database, select restore the entire database, and select the device to use to recover the database. Select Explicit dump device in the pop-up Select Dump Devices window and enter your GFZX.DMP store path in physical path and click OK.
4. Wait for ...
5, OK document two: Sybase in today's corporate database application performance is quite good, it can be easily applied to Windows systems and other operating systems, such as Linux,unix. Compared to the limitations of SQL Server only for Windows operating systems, Sybase's cross-platform nature makes her more popular with developers. Since many companies use Sybase as a carrier for database applications, how to keep the database secure. Today you will be briefed on how to back up and restore the Sybase database.
first, Sybase database characteristics:
The Sybase database product is the first truly RDBMS product based on customer/service architecture, which has played a positive role in the development of client/server computing technology. Its client/server model has the following advantages.
(1) Supports shared resources and balances load across multiple devices.
(2) Allow the environment to accommodate multiple hosts, make full use of the enterprise already have a variety of systems, is a truly open database, exposing the application interface Db-lib.
(3) Sybase is a high-performance database. The real attraction of Sybase is its high performance, which is embodied in programmable databases, event-driven triggers, and multiple cues.
However, because of the centralized data management method of Sybase database, the database server has a relatively centralized data, and the backup and recovery work is very important. In the actual day-to-day maintenance work, we have summed up the following Sybase database backup and Recovery methods. Here to do a brief introduction, I hope that the network administrator can be based on their own actual situation to take different methods of backup and recovery.
Second, the network environment and practical methods:
The network environment that describes the backup and recovery database is--the database server Sybase Adaptive Enterprise 11.5, and the network platform is Windows Server.
Using Database management tools Sybase-
Sybase Central is the main tool for managing Sybase, through which he can create new tables, build new databases, and correspond to relationships. Of course the work of backing up and restoring the database can also be given to him.
First step: Open Sybase, and select the name of the database server you want to back up. (Figure 1)
Figure 1 Click to see the big picture
Step Two: Use the Administrator sa login, start the backup server, (Figure 2) Select the database you want to back up, and right-click to select Backup. The system prompts you to "back up the entire database" or "Back up the transaction log", and we choose "Back up the entire database." (Figure 3)
Figure 2 Figure 3 Click to see the big picture
Step three: Choose the dump equipment you need to use, there are 3 of the dump equipment: the first is named dump device, such as backing up on a tape drive, and the second is an "explicit dump device," such as a backup on a hard disk, requiring a physical path, including a destination file name; the last one is "remote backup Server, you can implement remote backups.
Fourth step: The system prompts you to enter an optional backup name and you must use the same name in the recovery process. We can also choose whether to append or overwrite the backup as appropriate. After all of the above selections are complete, the system enters the Sybase tools console, starts the backup process, and then displays "finished". The operation of database recovery is similar to this.
Using the database management tool Sybase-the database backup and recovery is based on a full backup of the entire database.
Method Two: Using the dump command
Of course, any operation has a graphical interface and command line mode, although the graphical interface is easy to start, but the operation is not as fast as the command line. To get a clear picture of backup and recovery, we can also use the dump command to back up the database and transaction logs, while the Restore database and transaction log use the load command. The system performs a checkpoint when the database is dumped, that is, the logs and data are copied from the buffer to the hard disk, the allocated pages (logs and data) are copied to the dump device, and SQL Server sends a backup of the A list of all pages that have been modified by operations that are rarely written to the log (such as BCP). Backup server dumps these pages. SQL Server then instructs backup server to transfer all log pages that have been written during the reserve period. The last backup captures the state at nearly the end of the backup. Knowing the work step, we need to understand the specific operation instructions.
The syntax for backing up a database is:
DUMP DATABASE database_name to Dump_device
For example:
Dump DATABASE MyDB to MYDB-BK
The syntax for backing up the transaction log is:
DUMP TRANSACTION database_name to Dump_device
[WITH Truncate_only | and No_log | with No_truncate]
Restoring user databases
(1) The syntax for loading a database is:
Load database database_name from file_name
(2) The syntax for loading the transaction log is:
Load transaction database_name from file_name
(3) Database recovery:
1>load db_name Frome file_name
2>go
Log backups:
1>dump transaction db_name to file_name
2>go
Log recovery:
1>load transaction db_name Frome file_name
Notice here that when you use the Dump and load commands, you need to keep a detailed record of each staging, mount operation, and the amount of space required, and check the consistency of the database before you perform the backup operation.
Method Three: Full-scale backup of database structure and database records
In our actual application, the database is very large, the use of dump and load command is not the best choice. We can make a full backup of the database structure and data record separately.
(1) Backup of database structure
Use the Sybase graphical Interface System Management tool (Sybase) to select and generate DDL files for related content under the database that needs to be backed up, including database devices, logins, and so on. When the total number of tables and other database objects in the database is less than 255, you can generate a DDL file directly for the entire database. Note: Multiple DDL files should be generated in batches when the total is greater than 255.
(2) Backup of database records
Create an operating system batch file in advantage that uses BCP commands. The function of the database system is to exchange data between the datasheet and the operating system files. The format of the bcp command is as follows:
BCP table name out pathname name-c–t delimiter –u (username)-p (password)-s (server name).
For example, script:
Sekect "bcp" database name ... ", name" Out ", Name,". Out ""-usa_s server name "from sysobjects where type=" U "
Save the results of its execution as a batch file with a. bat extension.
(3) Restoration of database structure
The DDL files generated above can be recovered by using the Sybase graphical Interface System Management tool (Sybase Advantage) and then clicking "Excute" to create a database when the database structure is restored. Note: When a generated DDL file or SQL file is opened in advantage, more than 3000 lines may not be executed, and the isql command should be used in the operating system command-line mode. Its command format is
isql Uusername ppassword–i D11
such as: Isql-usa-ssybase-ixxx.sql (DLL)
(4) Recovery of data records
When you run the. bat batch file generated above in the operating system command-line mode, the records in all user tables of the database are automatically placed in several operating system files with the same name as the user table (extension. Out). On the basis of creating a good database structure, the above batch file "out" all modified to "in", the implementation of the modified batch file, copy the data into the user table, so as to achieve the recovery of data records.
Summary: The primary task of database backup and recovery is to make a secure copy of the data in order to effectively prevent data loss in the event of a failure. Therefore, in the actual application, should be based on specific circumstances, to develop a realistic backup and recovery program, to determine the extent of the data recoverability in a variety of fault situations to meet the needs of the application, so as to continuously improve the backup and recovery program.