defncopy

Description

Copies definitions for specified views, rules, defaults, triggers, or procedures from a database to an operating system file or from an operating system file to a database. This utility is available in the $SYBASE/$SYBASE_OCS/bin directory.

NoteThe defncopy utility cannot copy table definitions or reports created with Report Workbench™.

Syntax

defncopy 
     [-a display_charset]
     [-I interfaces_file] 
     [-J [client_charset]]
     [-P password] 
     [-R remote_server_principal]
     [-S [server_name]] 
     [-U user_name]
     [-v] 
     [-V [security_options]] 
     [-X]
     [-z language] 
     [-Z security_mechanism]
     {in file_name database_name |  out file_name database_name 
     [owner.]object_name [[owner.]object_name...] }

Parameters

-a display_charset

Runs defncopy from a terminal where the character set differs from that of the machine on which defncopy is running. Use -a in conjunction with -J to specify the character set translation file (.xlt file) required for the conversion. Use -a without -J only if the client character set is the same as the default character set.

NoteThe ascii_7 character set is compatible with all character sets. If either the Adaptive Server’s or client’s character set is set to ascii_7, any 7-bit ASCII character is allowed to pass between client and server unaltered. Other characters produce conversion errors. Character set conversion issues are covered more thoroughly in the Adaptive Server Enterprise System Administration Guide.

-I interfaces_file

Specifies the name and location of the interfaces file to search when connecting to Adaptive Server. If you do not specify -I, defncopy looks for the interfaces file, interfaces, located in the Sybase release directory.

-J client_charset

Specifies the character set to use on the client. A filter converts input between client_charset and the Adaptive Server character set.

-J client_charset requests that Adaptive Server convert to and from client_charset, the client’s character set.

-J with no argument sets character-set conversion to NULL. No conversion takes place. Use this if the client and server are using the same character set.

Omitting -J sets the character set to a default for the platform.The default may not necessarily be the character set that the client is using. (See the Adaptive Server Enterprise System Administration Guide for more information about character sets and the associated flags.

-P password

Allows you to specify your password. If you do not specify -P, defncopy prompts for your password. This option is ignored if -V is used.

-R remote_server_principal

Specifies the principal name for the server. By default, a server’s principal name matches the server’s network name (which is specified with the -S option or the DSQUERY environment variable). The -R parameter must be used when the server’s principal name and network name are not the same.

-S server_name

Specifies the name of the Adaptive Server to connect to. If you specify -S with no argument, defncopy looks for a server named SYBASE. If you do not specify -S, defncopy uses the server specified by your DSQUERY environment variable.

-U user_name

Allows you to specify a login name. Login names are case sensitive. If you do not specify username, defncopy uses the current user’s operating system login name.

-v

Displays the version number and copyright message of defncopy and returns to the operating system.

SDK binaries like defncopy have the same names in both the 32-bit and 64-bit products. Installing Adaptive Server Enterprise, the SDK, or Open Server 64-bit products with other Sybase 32-bit products overwrites the 32-bit binaries. Starting with ASE 15.0.2 and SDK/Open Server 15.0 ESD #9, the 64-bit binaries are replaced with 32-bit binaries on all 64-bit UNIX platforms to retain the peaceful coexistence of multiple products in the same Sybase installation. Since 32-bit binaries are released in the 64-bit EBF, the -v option of defncopy is no longer a valid way to check the EBF number for 64-bit products. Instead, you can use the UNIX strings and grep commands to confirm the EBF numbers for both Open Client and Open Server.

For example, to find the string containing the EBF number in the libsybct64.a library, enter the following:

strings -a libsybct64.a | grep EBF

This returns a string like the following:

Sybase Client-Library/15.0/P-EBF14602 ESD #9/DRV.15.0.3/SPARC/Solaris 8/BUILD1500-099/64bit/OPT/Thu May 24 19:18:39 2007

To find the string containing the EBF number in the libsybsrv64.a library, enter the following:

strings -a libsybsrv64.a | grep EBF

This returns a string like the following:

Sybase Server-Library/15.0/P-EBF14603-14602 ESD #9/DRV.15.0.3/SPARC/Solaris 8/BUILD1500-099/64bit/OPT/Thu May 24 19:19:49 2007
-V security_options

Specifies network-based user authentication. With this option, the user must log in to the network’s security system before running the utility. In this case, users must supply their network user name with the -U parameter; any password supplied with the -P parameter is ignored.

-V can be followed by a security_options string of key-letter options to enable additional security services. These key letters are:

  • c – Enable data confidentiality service

  • i – Enable data integrity service

  • m – Enable mutual authentication for connection establishment

  • o – Enable data origin stamping service

  • q – Enable out-of-sequence detection

  • r – Enable data replay detection

-X

Specifies that in this connection to the server, the application initiate the login with client-side password encryption. defncopy (the client) specifies to the server that password encryption is desired. The server sends back an encryption key, which defncopy uses to encrypt your password, and the server uses the key to authenticate your password when it arrives.

If the defncopy crashes, the system creates a core file which contains your password. If you did not use the encryption option, the password appears in plain text in the file. If you used the encryption option, your password is not readable.

-z language

The official name of an alternate language that the server uses to display defncopy prompts and messages. Without the -z flag, defncopy uses the server’s default language.

Add languages to an Adaptive Server at installation, or afterwards with the utility langinst or the stored procedure sp_addlanguage.

-Z security_mechanism

Specifies the name of a security mechanism to use on the connection.

Security mechanism names are defined in the libtcl.cfg configuration file located in the $SYBASE/ini directory. If no security_mechanism name is supplied, the default mechanism is used. For more information on security mechanism names, see the description of the libtcl.cfg file in the Open Client and Open Server Configuration Guide for UNIX.

in | out

Specifies the direction of definition copy.

file_name

Specifies the name of the operating system file destination or source for the definition copy. The copy out overwrites any existing file.

database_name

Specifies the name of the database to copy the definitions to or from.

object_name

Specifies name(s) of database object(s) for defncopy to copy out. Do not use object_name when copying definitions in.

owner

Specifying this is optional if you or the Database Owner own the table being copied. If you do not specify an owner, defncopy first looks for a table of that name that you own, and then looks for one owned by the Database Owner. If another user owns the table, you must specify the owner name or the command fails.

Examples

Example 1

Copies definitions from the file new_proc into the database stagedb on server MERCURY. The connection with MERCURY is established with a user of name “sa” and a NULL password.

defncopy -Usa -P -SMERCURY in new_proc stagedb

Example 2

Copies definitions for objects sp_calccomp and sp_vacation from the employees database on the Sybase server to the file dc.out. Messages and prompts are displayed in french. The user is prompted for a password.

defncopy -S -z french out dc.out employees sp_calccomp sp_vacation

Usage

WARNING! Long comments (more than 100 characters) placed before a create statement may cause defncopy to fail.