database problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mo/-/sin

    database problem

    hi i m mohsin....
    i m making a project on hospital management using c# at front end and
    sql server 2005 at backend........ .....
    my project is almost complete but now i m facing a problem........
    since i going to run the project on other systems also i m not able to
    copy the the databases to any otherr folder which i made for the
    project
    the databases are in c drive where i installed sql server 2005 but
    whenever i try o copy the databases it shows cannot copy city hospital
    database to another folder.. it is being used by another folder..
    plz help mee............
  • Tom van Stiphout

    #2
    Re: database problem

    On Sat, 23 Aug 2008 09:43:32 -0700 (PDT), "mo/-/sin"
    <Ri.mohsin@gmai l.comwrote:

    I'm assuming you tried to copy the .mdf file. It is in use by SQL
    Server. It's also not the recommended way to copy databases around.
    Rather you should make a backup, and restore it on the other system.

    -Tom.
    Microsoft Access MVP

    >hi i m mohsin....
    >i m making a project on hospital management using c# at front end and
    >sql server 2005 at backend........ .....
    >my project is almost complete but now i m facing a problem........
    >since i going to run the project on other systems also i m not able to
    >copy the the databases to any otherr folder which i made for the
    >project
    >the databases are in c drive where i installed sql server 2005 but
    >whenever i try o copy the databases it shows cannot copy city hospital
    >database to another folder.. it is being used by another folder..
    >plz help mee............

    Comment

    • mo/-/sin

      #3
      Re: database problem

      On Aug 23, 9:58 pm, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
      On Sat, 23 Aug 2008 09:43:32 -0700 (PDT), "mo/-/sin"
      >
      <Ri.moh...@gmai l.comwrote:
      >
      I'm assuming you tried to copy the .mdf file. It is in use by SQL
      Server. It's also not the recommended way to copy databases around.
      Rather you should make a backup, and restore it on the other system.
      >
      -Tom.
      Microsoft Access MVP
      >
      hi i m mohsin....
      i m making a project on hospital management using c# at front end and
      sql server 2005 at backend........ .....
      my project is almost complete but now i m facing a problem........
      since i going to run the project on other systems also i m not able to
      copy the the databases to any otherr folder which i made for the
      project
      the databases are in c drive where i installed sql server 2005 but
      whenever i try o copy the databases it shows cannot copy city hospital
      database to another folder.. it is being used by another folder..
      plz help mee............
      how i can make a backup......... ...

      Comment

      • Erland Sommarskog

        #4
        Re: database problem

        mo/-/sin (Ri.mohsin@gmai l.com) writes:
        how i can make a backup......... ...
        BACKUP DATABASE db TO DISK = '<somepath>' WITH INIT

        To restore in the other environment:

        RESTORE DATABASE db FROM DISK = '<somepath>'
        WITH MOVE 'datadev' TO 'filepath1.mdf' ,
        MOVE 'logdev' TO 'filepath2.ldf' ,
        REPLACE

        "datadev" and "logdev" are the logical name for the database files. You
        can see these with sp_helpdb in the first or second column. Filepath1
        and filepath2 are simply the location for the database files on the
        new server.


        --
        Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

        Links for SQL Server Books Online:
        SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
        SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
        SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

        Comment

        Working...