[성현모] Recovery 기능 추가

This commit is contained in:
SHM
2025-04-16 14:36:23 +09:00
parent 5c3405399e
commit 3eeb27cb31
5 changed files with 134 additions and 56 deletions

View File

@ -69,7 +69,7 @@ namespace DataBaseConnection.Control
public static Dictionary<string, SqlConnection> GetLongTermConn2()
{
return connLongTerm2;
}
}
public DatabaseConnControl()
{
@ -220,13 +220,7 @@ namespace DataBaseConnection.Control
public static void ConnectTestListDB(string strGetConnIPAddress, int nGetConnPort = CatalogConnPort)
{
try
{
//conn = new SqlConnection("Data Source=200.200.200.48,1433; Initial Catalog=LSU_Trimming_4th_ALIS; User ID=Alis; Password=kefico; MultipleActiveResultSets=True;");
//Data Source = {IP},{Port}; Initial Catalog = {SCHEMA}; User ID = {ID}; Password = {PW}; MultipleActiveResultSets=True;
//conn = new SqlConnection("Data Source=DESKTOP-5UQ1Q22;Initial Catalog=LSU_Trimming_4th_ALIS;Integrated Security=True;");
//conn = new SqlConnection("Data Source = 125.130.37.164,1433; Initial Catalog = LSU_Trimming_4th_ALIS; User ID = Alis; Password = kefico; MultipleActiveResultSets=True;");
//conn = new SqlConnection("Data Source = 127.0.0.1; Initial Catalog = Smart_Inhibitor_1th_ALIS; User ID = Alis; Password = kefico;"); //Integrated Security = SSPI;");
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
if (strGetConnIPAddress.Split(',').Length == 2)
@ -247,29 +241,17 @@ namespace DataBaseConnection.Control
else
builder.DataSource = strGetConnIPAddress + "," + nGetConnPort.ToString();
SqlCommand SQLCmd = new SqlCommand("spGetDBList", connMain);
SQLCmd.CommandType = CommandType.StoredProcedure;
SqlCommand SQLCmd = new SqlCommand("select name from sys.databases with(nolock) where owner_sid != 0x01;", connMain);
SQLCmd.CommandType = CommandType.Text;
DbDataReader dtReader = SQLCmd.ExecuteReader();
DataTable dtResult = new DataTable();
dtResult.Load(dtReader);
List<string> list = dtResult?.AsEnumerable()?.Select(x => x.ItemArray?.First()?.ToString())?.ToList();
if (list?.Count > 0)
{
//short term
var shortTermCatalogName = list.Find(x => x.ToLower().Contains("short") && x.ToLower().Contains("json"));
if (string.IsNullOrEmpty(shortTermCatalogName) == false)
{
ShortTermCatalogName = shortTermCatalogName;
}
//long term
var longTermCatalogName = list.FindAll(x => x.ToLower().Contains("long") && x.ToLower().Contains("json"));
if (longTermCatalogName?.Count() > 0)
{
LongTermCatalogName?.Clear();
LongTermCatalogName.AddRange(longTermCatalogName);
}
{
LongTermCatalogName?.Clear();
LongTermCatalogName.AddRange(list);
}
dtReader.Close();