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 in the $SYBASE/$SYBASE_OCS/bin.
defncopy cannot
copy table definitions or reports created with Report Workbench™.
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...] }
Runs defncopy from a terminal where the character set differs from that of the machine on which defncopy is running. Use -a 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.
The ascii_7
character set is compatible with all character sets. If either the
Adaptive Servers or the client’s character set is set to ascii_7, any
7-bit ASCII character is allowed
to pass unaltered between client and server. Other characters produce
conversion errors. Character set conversion issues are discussed
thoroughly in the Adaptive Server Enterprise System Administration Guide.
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.
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.
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.
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.
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.
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.
Displays the version number and copyright message of defncopy, then returns to the operating system.
SDK binaries like defncopy use the same names in both 32-bit and 64-bit products. Installing Adaptive Server, the SDK, or Open Server 64-bit products with other Sybase 32-bit products overwrites the 32-bit binaries. Starting with Adaptive Server 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. Since 32-bit binaries are included 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, 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:
strings -a libsybct64.a | grep Sybase
This returns a string similar to:
Sybase Client-Library/15.5/P/DRV.15.5.0/SPARC/Solaris 8/BUILD1550-001/64bit/OPT/Mon Aug 10 23:04:17 2009
To find the string containing the EBF number in the libsybsrv64.a library, enter:
strings -a libsybsrv64.a | grep Sybase
This returns a string similar to:
Sybase Server-Library/15.5/P/DRV.15.5.0/SPARC/Solaris 8/BUILD1550-001/64bit/OPT/Mon Aug 10 23:06:27 2009
Specifies network-based user authentication. With this option, the user must log in to the network’s security system before running defncopy. 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 that enables additional security services:
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.
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 defncopy fails, 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.
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 during installation, or afterwards using the utility langinst or the stored procedure sp_addlanguage.
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. See the description of the libtcl.cfg file in the Open Client and Open Server Configuration Guide for UNIX.
Specifies the direction of definition copy.
Specifies the name of the operating system file destination or source for the definition copy. The copy out overwrites any existing file.
Specifies the name of the database to copy the definitions to or from.
Specifies names of database objects for defncopy to copy out. Do not use object_name when copying definitions in.
Specifying owner 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.
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
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 appear in French. The user is prompted for a password.
defncopy -S -z french out dc.out employees sp_calccomp sp_vacation
Invoke the defncopy program directly from the operating system. defncopy provides a noninteractive to copy out definitions (create statements) for views, rules, defaults, triggers, or procedures from a database to an operating system file. Alternatively, it copies in all the definitions from a specified file.
You must have select permission on the sysobjects and syscomments tables to copy out definitions; you do not need permission on the object itself.
You must have the appropriate create permission for the type of object you are copying in. Objects copied in belong to the copier. A system administrator copying in definitions on behalf of a user must log in as that user to give the user proper access to the reconstructed database objects.
The in filename or out filename and the database name are required and must be unambiguously stated. For copying out, use file names that reflect both the object’s name and its owner.
defncopy ends each definition that it copies out with:
/* ### DEFNCOPY: END OF DEFINITION */
When assembling definitions in an operating system file to be copied into a database using defncopy, each definition must be terminated using the “END OF DEFINITION” string.
Enclose values specified to defncopy in quotation marks if they contain characters that could be significant to the shell.
WARNING! Long comments (more than 100 characters) placed before a create statement may cause defncopy to fail.