MS SQL Permission on IIS 6

Please support our MS SQL advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

MS SQL Permission on IIS 6

 
0
  #1
Sep 11th, 2009
Hello everyone,

i wrote an application that makes database backups and zips them.

Can anyone please tell me what i need to do in order to get the apllication to work on IIS 6 windows server 2003 SQL 05

1. The application works fine on machines for both XP and VISTA.
2. The application runs fine on Win Server 2003 however :

my problem is : obviously the database is in use by the web site.

How can i give my application permission to make the backup while the website is connected to the database ?

regards,
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: MS SQL Permission on IIS 6

 
0
  #2
Sep 11th, 2009
You need to issue a backup command to the SQL Server and then archive the .bak file. You never want to access the .mdf and .ldf files directly.

Use this query:
BACKUP DATABASE [DBName] TO  DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL\BackUpManual\DBName.bak' WITH  INIT ,  NOUNLOAD ,  NAME = N'DBName backup',  NOSKIP ,  STATS = 10,  NOFORMAT

Note: The file path is relative to the machine running the SQL Server, not the client issuing the command
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: MS SQL Permission on IIS 6

 
0
  #3
Sep 11th, 2009
Hi my friend , i have that .

  1. /// <summary>
  2. /// Backups are done here
  3. /// </summary>
  4. #region Backup Methods
  5. #region Full Backup method
  6. void Fullbackup()
  7. {
  8.  
  9. method = "Full";
  10. // Creating connection
  11. Username = txtUsername.TEXT;
  12. Password = txtPassword.TEXT;
  13. // specifying connection string
  14. DBhandler.DbWinHandler dbHandler = new DBhandler.DbWinHandler("Data Source=" + txtServerName.TEXT + ";Initial Catalog=master;Persist Security Info=True;User ID=" + Username + ";Password=" + Password);
  15.  
  16. // Getting the items that has to be backed up
  17. foreach (string lstItem IN listBoxControl2.Items)
  18. {
  19. dbName = lstItem;
  20.  
  21. if (!Directory.EXISTS(textEdit1.TEXT + "/DataSafe Backups/Temp/"))
  22. {
  23. DirectoryInfo newDir = new DirectoryInfo(textEdit1.TEXT + "/DataSafe Backups/Temp/");
  24. newDir.CREATE();
  25. }
  26.  
  27. lblStatus.TEXT = "Backing up " + dbName;
  28. lblStatus.Refresh();
  29. dbHandler.SmartGetDataSet("BACKUP DATABASE " + dbName + " TO DISK = '" + textEdit1.TEXT + "/DataSafe Backups/Temp/" + dbName + ".bak' WITH NAME = '" + dbName + ".bak'");
  30.  
  31. ZipFile();
  32. }
  33. }
  34. #endregion
  35.  
  36. #region Differential Backup method
  37. void Diffbackup()
  38. {
  39. method = "Diff";
  40. // Creating connection
  41. Username = txtUsername.TEXT;
  42. Password = txtPassword.TEXT;
  43. // specifying connection string
  44. DBhandler.DbWinHandler dbHandler = new DBhandler.DbWinHandler("Data Source=" + txtServerName.TEXT + ";Initial Catalog=master;Persist Security Info=True;User ID=" + Username + ";Password=" + Password);
  45.  
  46. // Getting the items that has to be backed up
  47. foreach (string lstItem IN listBoxControl2.Items)
  48. {
  49. dbName = lstItem;
  50.  
  51. if (!Directory.EXISTS(textEdit1.TEXT + "/DataSafe Backups/Temp/"))
  52. {
  53. DirectoryInfo newDir = new DirectoryInfo(textEdit1.TEXT + "/DataSafe Backups/Temp/");
  54. newDir.CREATE();
  55. }
  56.  
  57. lblStatus.TEXT = "Backing up " + dbName;
  58. lblStatus.Refresh();
  59. dbHandler.SmartGetDataSet("BACKUP DATABASE " + dbName + " TO DISK = '" + textEdit1.TEXT + "/DataSafe Backups/Temp/" + dbName + "_Differential.bak' WITH DIFFERENTIAL, NAME = '" + dbName + ".bak'");
  60.  
  61. ZipFile();
  62. }
  63. }
  64. #endregion
  65.  
  66. #region LOG backup method
  67. void Logbackup()
  68. {
  69. method = "Log";
  70. // Creating connection
  71. Username = txtUsername.TEXT;
  72. Password = txtPassword.TEXT;
  73. // specifying connection string
  74. DBhandler.DbWinHandler dbHandler = new DBhandler.DbWinHandler("Data Source=" + txtServerName.TEXT + ";Initial Catalog=master;Persist Security Info=True;User ID=" + Username + ";Password=" + Password);
  75.  
  76. // Getting the items that has to be backed up
  77. foreach (string lstItem IN listBoxControl2.Items)
  78. {
  79. dbName = lstItem;
  80.  
  81. if (!Directory.EXISTS(textEdit1.TEXT + "/DataSafe Backups/Temp/"))
  82. {
  83. DirectoryInfo newDir = new DirectoryInfo(textEdit1.TEXT + "/DataSafe Backups/Temp/");
  84. newDir.CREATE();
  85. }
  86.  
  87. lblStatus.TEXT = "Backing up " + dbName;
  88. lblStatus.Refresh();
  89. dbHandler.ExecuteCommand("BACKUP LOG " + dbName + " TO DISK = '" + textEdit1.TEXT + "/DataSafe Backups/Temp/" + dbName + "_LOG.bak' WITH NAME = '" + dbName + ".bak'");
  90.  
  91. ZipFile();
  92. }
  93. }
  94. #endregion
  95. #endregion

PS the DBhandler.DbWinHandler is just a class we use to connect to SQL.

should i add any of the following ?

INIT ,
NOUNLOAD
NOSKIP ,
STATS = 10,
NOFORMAT

????
Last edited by cVz; Sep 11th, 2009 at 7:40 am.
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: MS SQL Permission on IIS 6

 
0
  #4
Sep 11th, 2009
What is the error you receive?
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: MS SQL Permission on IIS 6

 
0
  #5
Sep 11th, 2009
well it just bounces ...

No error...

however the backup file is 0 bytes
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: MS SQL Permission on IIS 6

 
0
  #6
Sep 11th, 2009
Well try a full backup (using the query I posted) instead of a differential backup. This will indicate if backups are working at all.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Reply


Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC