Guest User

Untitled

a guest
Jan 15th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Diagnostics;
  4. using System.Threading;
  5. using System.Net.NetworkInformation;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text.RegularExpressions;
  9. using System.Text;
  10.  
  11. namespace Imp
  12. {
  13. class Program
  14. {
  15. public static void Main(string[] args)
  16. {
  17. string[] table = File.ReadAllLines("tabele.txt");
  18. Process cmd = new Process();
  19. cmd.StartInfo.RedirectStandardInput = true;
  20. cmd.StartInfo.RedirectStandardOutput = true;
  21. cmd.StartInfo.UseShellExecute = false;
  22. cmd.StartInfo.CreateNoWindow = false;
  23. cmd.StartInfo.FileName = "cmd.exe";
  24. cmd.Start();
  25. int x=0;
  26. Thread t = new Thread(new ThreadStart(Compress()));
  27. while(x<table.Length)
  28. {
  29. for(int i=0; i<table.Length; i++)
  30. {
  31. cmd.StandardInput.WriteLine("imp market3_user/for8667319com file=expm.dat tables={0}",table[i]);
  32. Thread.Sleep(1000);
  33. }
  34. if(x>0)
  35. {
  36. x-=1;
  37. t.Start(x);
  38. }
  39. x++;
  40. }
  41. //t.Start();
  42. Console.ReadLine();
  43. }
  44.  
  45. public static void Compress(int x)
  46. {
  47. string[] table = File.ReadAllLines("tabele.txt");
  48. for(; x<table.Length; x++)
  49. {
  50. SQLplus query = new SQLplus("market3_user/for8667319com");
  51. string result = query.execute(@"DECLARE
  52. CURSOR cu_indeksy_m IS
  53. SELECT index_name
  54. FROM all_indexes
  55. WHERE index_type = 'NORMAL'
  56. AND temporary = 'N'
  57. AND table_owner = 'MARKET3_USER'
  58. AND table_name = '{table[i]} '
  59. ORDER by table_name ASC, index_name ASC;
  60.  
  61. BEGIN
  62. execute immediate 'alter table {table[i]} move ROW STORE COMPRESS ADVANCED storage (INITIAL 65536)';
  63. FOR i IN cu_indeksy_m LOOP
  64. execute immediate 'alter index ' || i.index_name || ' rebuild COMPRESS ADVANCED HIGH storage (INITIAL 65536)';
  65. Dbms_Output.put_line('Skompresowano index: ' || i.index_name);
  66. END LOOP;
  67.  
  68. END;
  69. /");
  70. }
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment