data lost after restore database

I want to change the database name so I delete the database and add the database with other name
After that, I restore the data by using the function "Restore Database".
Then, I find that some data has lost. Why do it? Is it the database restore older data instead new?
If it is right, how can I recover the new data.
huang_ckAsked:
Who is Participating?
 
AustinSevenConnect With a Mentor Commented:
If you are only backing up your database using full backups (not transaction log backups as well), the data you restore can only be as 'new' as the time of your last full backup.   The backup can never including newer data than the database it was backed up from.   So, if you want a restore to contain the latest data, do a full backup immediately before you restore it.   That is how you will recover the new data.  

There is a more complicated answer that involves recover latest data from a full backup and transaction log backups but I don't think you want to get into this just yes.  Concentrate on the basics.

AustinSeven
0
 
pcsentinelCommented:
Alternatively use the DTS Import / Export Wizard to Import the data from the original database into a new dataabse with the name you want

regards
0
 
pcsentinelCommented:
Also if you just want to change the database name you can use

sp_renamedb which will change the database name without a backup

regards
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
huang_ckAuthor Commented:
Thank you for your reply.

Now I would like to backup the sql server daily by using the SQL Server Agent.
I would like to create a new step but I don't know what do I choose the type and command to backup the hold database which name as "myDB" and I must backup all my table.

Another question is that when I just backup the file under the folder of c:/program file/microsoft sql server/sql. Is it work?
0
 
AustinSevenCommented:
backup database mydb to disk = 'c:\backups\mydb.bak'

or create a device in Enterprise Manager and do...

backup database bydb to myDb_dump

-- where the myDb_dump points to a backup file placed anywhere, eg. C:\backups

Create a job and a step within the job with the above backup command in it.  Schedule the job and you're done.

AustinSeven
0
 
AustinSevenCommented:
...or you can use a Maintenance Plan wizard to create your backup plan for you.

AustinSeven
0
 
rafranciscoCommented:
>> Another question is that when I just backup the file under the folder of c:/program file/microsoft sql server/sql. Is it work?<<

For you to be able to backup the files under the c:/program file/microsoft sql server/sql folder, SQL Server has to be down because the data files will be in use and you cannot back it up.  Your best option is to use Maintenance Plan to back up your database.
0
 
rafranciscoCommented:
huang_ck, were you able to solve this issue?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.