Defncopy [Definition & Copy]
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
- Invoke the defncopy program directly from the operating system. defncopy provides a non-interactive way of copying 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 the comment
/* ### 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.
Syntax
defncopy
[-v] [-X]
[-a display_charset]
[-I interfaces_file]
[-J [client_charset]]
[-K keytab_file]
[-P password]
[-R remote_server_principal]
[-S [server]]
[-U username]
[-V [security_options]]
[-z language]
[-Z security_mechanism]
{in filename dbname | out filename dbname
[owner.]objectname [[owner.]objectname...] }
Parameters
- in | out specifies the direction of definition copy in relation to the database. For example, specifying “in” copies definitions into the database.
- filename specifies the name of the operating system file destination or source for the definition copy. The copy out overwrites any existing file.
- dbname specifies the name of the database to copy the definitions from or to.
- objectname specifies name(s) of database object(s) for defncopy to copy out. Objects should not be specified when copying definitions into a database.
- -a display_charset allows you to run defncopy from a terminal where the character set differs from that of the machine on which defncopy is running. -a in conjunction with -J specifies 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.
- -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 an interfaces file located in the directory specified by the SYBASE environment variable.
- -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 System Administration Guide and the System Administration Guide Supplement for more information about character sets and the associated flags.
- -K keytab_file can be used only with DCE security. It specifies a DCE keytab file that contains the security key for the user name specified with -U option. Keytab files can be created with the DCE dcecp utility. See your DCE documentation for more information.
- If the -K option is not supplied, the user of defncopy must be logged in to DCE with the same user name as specified with the -U option.
- -P password allows you to specify 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 option must be used when the server’s principal name and network name are not the same.
- -Sserver specifies the name of the Adaptive Server to connect to. Without -S, defncopy looks for the server specified by your DSQUERY environment variable.
- -U username 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 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 option; any password supplied with the -P option 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
- r – Enable data replay detection
- q – Enable out-of-sequence detection
- -v displays the version number and copyright message of defncopy and returns to the operating system.
- -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 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 specifies 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 langinstall 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 $SYBASE/install/libtcl.cfg configuration file. 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.
defncopy for out
defncopy -Usa -S<servername> out <filename>,<dbname>,<objectname>
defncopy -Usa -Ssybase123 out sp_helpdb.out,sysbsysteprocess,sp_helpdb
defncopy for in
defncopy -Usa -S<servername> in <filename>,<dbname>
defncopy -Usa -Ssybase123 out sp_helpdb.out,sysbsysteprocess
*** for doing this we need to drop the procedure sp_helpdb
No comments:
Post a Comment