.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

BACK UP SQL Server Database

Posted By: kishore     Posted Date: June 09, 2010    Points:2   Category :Sql Server
1.create database ABC


2.backup database ABC to disk='D:\backup\DB\ABC.bak'

Here i created a new database 'ABC'.NOW my DATABASE is empty(no objects where created), i am taking full back up,the out put i am getting

OUTPUT:

Processed 152 pages for database 'ABC', file 'ABC' on file 1.
Processed 2 pages for database 'ABC', file 'ABC_log' on file 1.
BACKUP DATABASE successfully processed 154 pages in 0.267 seconds (4.698 MB/sec).

MY dout is even though my database is not having any objects,why it is backup 152 pages data file,
i did't done any transations even why it backuped 2 pages of log files.

2) AGAIN when i take the LOG BACKUP ,with out doing any transaction again it showing that " 2 log pages where backuped"

backup log ABC to disk='D:\backup\DB\ABC.bak'

OUTPUT:
Processed 2 pages for database 'ABC', file 'ABC_log' on file 2.
BACKUP LOG successfully processed 2 pages in 0.056 seconds (0.219 MB/sec).

3)AGAIN when i take the log backup ,it showing 'ZERO pages backuped'(no transation were done)

backup log ABC to disk='D:\backup\DB\ABC.bak'

OUTPUT:
Processed 0 pages for database 'ABC', file 'ABC_log' on file 3.
BACKUP LOG successfully processed 0 pages in 0.033 seconds (0.000 MB/sec).


can any one tell why it backuped 152 pages ,2 pages even though database is empty.
after taking taking log backup second time it showing zero pages .WHY?

plz answer me any one
Thankyou


Responses
Author: krishana singh             
Posted Date: December 08, 2010     Points: 5   

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace projectname
{
public partial class frmBackup : Form
{
SqlConnection con = new SqlConnection();
string databasename="";
public frmBackup()
{
InitializeComponent();
}

private void btnBrowser_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
txtBackUp.Text = saveFileDialog1.FileName.ToString() + ".bak";
}

private void btnSave_Click(object sender, EventArgs e)
{
string s;

System.IO.File.Delete(txtBackUp.Text.Trim().ToString());
try
{
s = System.DateTime.Today.ToString();
SqlCommand cmd = new SqlCommand("BACKUP DATABASE " + databasename + " TO DISK='" + txtBackUp.Text + "' ", con);
if (con.State == ConnectionState.Open)
con.Close();
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("BackUp the database successfully at " + txtBackUp.Text.ToString(), "Backup Database", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show("DataBase Does not Exist", "Backup Database", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
con.Close();
txtBackUp.Text = "";
}
}

private void btncancel_Click(object sender, EventArgs e)
{
txtBackUp.Text = "";
}
}
}




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend