Copies one abstract plan to an abstract plan group.
sp_copy_qplan src_id, dest_group
is the ID of the abstract plan to copy.
is the name of the destination abstract plan group.
sp_copy_qplan 2140534659, ap_stdin
The destination group must exist before you can copy an abstract plan into it. You do not need to specify a source group, since plans are uniquely identified by the plan ID.
A new plan ID is generated when the plan is copied. The plan retains the ID of the user who created it, even if the System Administrator or Database Owner copies the plan. To assign a different user ID, a System Administrator or Database Owner can use sp_export_qpgroup and sp_import_qpgroup.
If the query text for a plan in the destination group exactly matches the query text in the source group and the user ID, the plan is not copied, and a message giving the plan IDs is sent to the user.
To copy all of the plans in an abstract plan group, use sp_copy_all_qplans.
Any user can execute sp_copy_qplan to copy a plan that he or she owns. Only the System Administrator or Database Owner can copy plans that are owned by other users.
Values in event and extrainfo columns from the sysaudits table are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
38 |
exec_procedure |
Execution of a procedure |
|
System procedures sp_copy_all_qplans, sp_help_qpgroup, sp_help_qplan, sp_import_qpgroup