CREATE DECRYPTED DATABASE statement

This statement creates a decrypted copy of an existing database, including all transaction logs and dbspaces.

Syntax
CREATE DECRYPTED DATABASE newfile
FROM oldfile 
[ KEY key ] 
Parameters
  • FROM clause   Use this clause to specify the name of the database to copy (oldfile).

  • KEY clause   Use this clause to specify the encryption key needed to decrypt the database. You do not specify the KEY clause if the existing database was encrypted with SIMPLE encryption, which does not require a key.

Remarks

The CREATE DECRYPTED DATABASE statement produces a new database file (newfile), and does not replace or remove the original database file (oldfile).

All encrypted tables in oldfile are not encrypted in newfile, and table encryption is not enabled.

Note

For databases created with SQL Anywhere version 11.0.0 and later, the ISYSCOLSTAT, ISYSUSER, and ISYSEXTERNLOGIN system tables always remain encrypted to protect the data from unauthorized access to the database file.

If oldfile uses transaction log or transaction log mirror files, they are renamed newfile.log and newfile.mlg, respectively.

If oldfile contains dbspace files, a D (decrypted) is added to the file name. For example, when you execute the CREATE DECRYPTED DATABASE statement, if oldfile is mydbspace.dbs, newfile becomes mydbspace.dbsD.

You cannot execute this statement on a database that requires recovery. Also, this statement is not supported in procedures, triggers, events, or batches.

Permissions

Must be a user with DBA authority.

Side effects

None.

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Example

The first statement below creates an AES256-encrypted copy of the demo.db called demoEncrypted.db,. The second statement creates a decrypted copy of demoEncrypted.db called demoDecrypted.db.

CREATE ENCRYPTED DATABASE 'demoEncrypted.db'
   FROM 'demo.db'
   KEY 'Sd8f6654*Mnn'
   ALGORITHM 'AES256';
CREATE DECRYPTED DATABASE 'demoDecrypted.db'
   FROM 'demoEncrypted.db'
   KEY 'Sd8f6654*Mnn';