Creating backups is part of regular administrative duties, and GlassFish Server supports two ways to perform this duty:
Automatically on a scheduled basis, as described in Setting Up Automatic Backups of a Domain
Manually, as described in this section
The following topics are addressed here:
When you use the backup-domain subcommand, GlassFish Server creates a ZIP file backup of all the files and subdirectories in the domain's directory, domain-root-dir/domain-name, except for the backups subdirectory.
The backup-domain subcommand provides several options to meet particular needs, including:
--backupdir to specify a directory in which to store the backup instead of the default domain-root-dir/domain-name/backups.
--description to provide a description of the backup to be stored in the backup itself.
The backup-domain subcommand operates only when the domain is stopped or suspended.
Start or resume the domain.
Example 3-25 Backing Up the Default Domain
This example makes a backup of the default domain, domain1, storing the backup file in /net/backups.example.com/glassfish:
asadmin> backup-domain --backupdir /net/backups.example.com/glassfish domain1 Backed up domain1 at Mon Jan 17 08:16:22 PST 2011. Command backup-domain executed successfully
You can also view the full syntax and options of the subcommand by typing asadmin help backup-domain at the command line.
The restore-domain subcommand can use backup files created by the backup-domain subcommand and by automatic backup configurations, both full backups and configuration-only backups. Automatic backup configurations are available only in Oracle GlassFish Server.
The restore-domain subcommand operates only when the domain is stopped.
Example 3-26 Restoring the Default Domain
This example restores files for the default domain, domain1, from the most recent backup stored in a specified backup directory:
asadmin> restore-domain --backupdir /net/backups.example.com/glassfish domain1 Restored the domain (domain1) to /home/user1/glassfish3/glassfish/domains/domain1 Command restore-domain executed successfully.
You can also view the full syntax and options of the subcommand by typing asadmin restore-domain --help at the command line.
Use the list-backups subcommand in local mode to display information about backups of a specified domain stored in a specified backup directory.
The list-backups subcommand provides several options to meet particular needs, including:
--backupdir to specify a directory where backups are stored instead of the default domain-root-dir/domain-name/backups.
Example 3-27 Listing Backups of the Default Domain
This example lists the backups of the default domain, domain1, that are stored in the /net/backups.example.com/glassfish directory:
asadmin> list-backups --backupdir /net/backups.example.com/glassfish domain1 CONFIG USER BACKUP DATE FILENAME user1 Mon Jan 17 08:16:22 PST 2011 domain1_2011_01_17_v00001.zip monthly-full user1 Wed Dec 01 00:00:00 PST 2010 domain1_2010_12_01_v00001.zip monthly-full user1 Sat Jan 01 00:00:03 PST 2011 domain1_2011_01_01_v00001.zip monthly-full user1 Tue Feb 01 00:00:01 PST 2011 domain1_2011_02_01_v00001.zip Command list-backups executed successfully.
Note that this listing includes backups created automatically by a backup configuration. This feature is available only in Oracle GlassFish Server.
You can also view the full syntax and options of the subcommand by typing asadmin help list-backups at the command line.