使用SQLPLUS備份儲存過程

2021-08-30 05:55:55 字數 787 閱讀 3957

set echo off

set newpage none

set feedback off

set linesize 2500

set heading off

set pagesize 0

set termout off

set trimout on

set trimspool on

col procline for a2000

spool [color=red][b]c:\procbak2.sql[/b][/color]

select decode(rn,1 , 'create or replace ','')||text||decode(rn,cnt,chr(13)||chr(10)||'/'||chr(13)||chr(10),'') procline

from (select row_number() over(partition by name order by line) rn,

count(*) over(partition by name) cnt,

rtrim(text) text from all_source where owner='[color=red][b]jxc2[/b][/color]')

;spool off

[b]注:

1.上面檔案存成乙個檔案,然後用@執行即可;

2.紅色字根據具體情況進行修改;

3.此指令碼可以將procedure、function備份成乙個可直接執行的指令碼;[/b]

部落格:

網路硬碟:

sql plus與儲存過程舉例

一 表結構 create table create table card bin ctrl card bin char 12 not null,card len integer not null,channel type char 2 not null,card bin len integer,ca...

儲存過程備份SQL日誌

set nocount on declare logicalfilename sysname,maxminutes int,newsize int use abc 要操作的資料庫名 select logicalfilename abc log 日誌檔名 maxminutes 10,limit on ...

個人備份 mysql儲存過程

引數 插入記錄的起始id,客戶id,記錄數,初始使用者名稱 delimiter create procedure batchinsert in init int in cid int in loops int in username varchar 64 begin declare myid int...