码迷,mamicode.com
首页 > 数据库 > 详细

[转][C#][Oracle]备份

时间:2020-04-14 20:57:44      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:sel   details   oracl   oracle   roc   tail   procedure   detail   foreach   

// 获取所有存储过程 -- owner,
string sql = @"select object_name
from dba_objects
where object_type=‘PROCEDURE‘
and owner=‘DBO‘";

string sql2 = @"select text from user_source where name = :a and type=‘PROCEDURE‘";
IEnumerable<string> axs = conn.Query<string>(sql);

if(axs != null && axs.Count() > 0)
{
    foreach (var item in axs)
    {
        IEnumerable<string> proc = conn.Query<string>(sql2, new { 
            a = item
        });

        if(proc != null && proc.Count()>0)
        {
            var sw = File.CreateText(@"D:\" + item + ".sql");
            sw.Write(string.Join("", proc));
            sw.Close();
        }
    }
}

转自:https://blog.csdn.net/qq_30189805/article/details/99288790

转自:https://blog.csdn.net/huangbaokang/article/details/95446606

[转][C#][Oracle]备份

标签:sel   details   oracl   oracle   roc   tail   procedure   detail   foreach   

原文地址:https://www.cnblogs.com/z5337/p/12700177.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!