Using Command Line To Create Database Snapshots

You can automate creation of target database snapshots using the command line.

note Note

The command line functionality is available only in certain editions of Data Compare for Oracle. For the detailed information on features availability in the Data Compare for Oracle editions, please refer to the Editions topic.

To create a snapshot of target database through the command line, do the following:

  1. Open Command Prompt by pressing Win+R, and typing ‘cmd’ in the Open line.
  2. Type a path to the datacompare.com file, located in dbForge Data Compare for Oracle installation folder on your PC, and press the SPACE bar.

     "C:\Program Files\Devart\dbForge Data Compare for Oracle\datacompare.com"
    
  3. Specify the action you want to perform:
    "C:\Program Files\Devart\dbForge Data Compare for Oracle\datacompare.com" /snapshot
    
  4. Specify the connection string and schemas:
    "C:\Program Files\Devart\dbForge Data Compare for Oracle>datacompare.com /snapshot /connection:"User Id=hr;Server=ORCL;Unicode=True" /s:"SH,SH"
    
  5. Press ENTER to run the process.

Tip: To see a quick help on the switches available for the /snapshot operation, type the following:

"C:\Program Files\Devart\dbForge Data Compare for Oracle\datacompare.com" /snapshot /?

Additional arguments

You can edit the generated file to add some additional parameters, for example:

  • To write a comment, type:

      /comment:<value>
    
  • To apply compression to your snapshot file, type:
    /compress:[value]
    

    To turn this option on, type Yes, Y, On, True, T.

    To turn this option off, type No, N, Off, False, F.

  • To specify full connection string with additional parameters, type:

    connection:<connection_string>
    

    This argument is required.

  • To specify a file name and its path to save the created snapshot file, type:

    /file:<file_path>
    

    If the path is not specified, the snapshot will be saved to the current directory.

  • To specify server password, type:

    /password:<pw> 
    

    Define this argument to override the password specified in the connection string.

Command line used to make a snapshot of a schema may look like:

"C:\Program Files\Devart\dbForge Data Compare for Oracle\datacompare.com" /snapshot /connection:"User Id=hr;Server=ORCL;Unicode=True;" /password:my_pass /schema:"HR" /file:"result.snap"

If you connect to the server in the Direct mode, the connection parameters will differ and the command line used to make a snapshot of a schema will look like:

"C:\Program Files\Devart\dbForge Data Compare for Oracle\datacompare.com" /snapshot /connection:"User Id=hr;Server=dbOracle;Connect Mode=SysDba;Unicode=True;Direct=True;Service Name=ORCL" /password:my_pass /schema:"HR" /file:"result.snap"