defncopy

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.

The utility is located in:
  • (UNIX) $SYBASE/$SYBASE_OCS/bin.

  • (Windows) %SYBASE%\%SYBASE_OCS%\bin, as defncopy.exe.

Syntax

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

Parameters

Examples

Usage

  • Use this syntax for defncopy_r if you are using threaded drivers.

  • Use this syntax for defncopy you are using threaded drivers in the IBM platform.

  • Set the SYBASE environment variable to the location of the current version of SAP ASE before using defncopy.

  • Invoke the defncopy program directly from the operating system. defncopy provides a noninteractive way 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.

  • The in filename or out filename and the database name are required and must be stated unambiguously. 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 the comment:
    /* ### DEFNCOPY: END OF DEFINITION */

    Definitions created as text must end with this comment so that defncopy can copy them in successfully.

  • Enclose values specified to defncopy in quotation marks, if they contain characters that could be significant to the shell.

    Warning!  Long comments of more than 100 characters that are placed before a create statement may cause defncopy to fail.
  • SDK binaries like defncopy use the same names in both 32-bit and 64-bit products. Installing SAP ASE, the SDK, or Open Server 64-bit products with other Sybase 32-bit products overwrites the 32-bit binaries. Starting with SAP 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. 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
See also:
  • Reference Manual: Commandscreate, select
  • Reference Manual: Proceduressp_addlanguage, sp_checkreswords, sp_configure, sp_procqmode, sp_remap

Permissions

  • 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 may not have select permission on the text column of the syscomments table if the system security officer has reset the allow select on syscomments.text column parameter with the system procedure sp_configure. This reset restricts select permission to the object owner and the system administrator. This restriction is required in order to run SAP ASE in the evaluated configuration , as described in the installation and configuration documentation for your platform. In this case, the object owner or a system administrator must execute defncopy to copy out definitions.

    Note: If the text has been encrypted, it may be hidden from you even if you have all the required permissions. See “Verifying and Encrypting Source Text” in the Transact-SQL User’s Guide.
  • 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.

Tables used

syscomments, sysobjects

Related concepts
Threaded Versions of Utilities
Utility Commands Reference
Database Creation and Manipulation Utilities
Related reference
langinstall