Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2004
    Posts
    10

    Unanswered: Import db from dump with bcp

    I am trying to import a database from a dump file.
    The dump file is from a sql server db.

    I have created the db on another server and want to import the data from the
    dump file.

    I use the bcp like this :

    bcp nnfdb.sa.users in x -Usa -P

    nnfdb is the name of the database
    users is the name of a table
    x is the name of the dump file.

    But I get this error :
    SQLState = S0002, NativeError = 208
    Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
    'nnfdb.sa.users'.

    also I am sure if I have to run the bcp for each table or if I can import
    all tables in one bcp run.

    Regards

    Kris

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    You may need to specify the server in the bcp-command. As far as I know bcp works on one table for each run, so you may need to run bcp a few times.

    Sometimes it's easier and more convenient to just copy the entire database from one location to another (instead of coping each table one by one).

    What's the format of the dump file?

  3. #3
    Join Date
    Dec 2004
    Posts
    10
    I have also tryed this :

    bcp nnfdb.sa.users in x -Usa -P -Sdk1052

    dk1052 is the name of my local machine.

    But I get the same error.

    How could I copy the hole db in one step ?

    Kris

  4. #4
    Join Date
    Dec 2004
    Posts
    10
    I now found out that if I use dbo instead of sa I dont get the same error.

    So I use :

    bcp nnfdb.dbo.users in x -Usa -P -Sdk1052

    But it lookes like it is trying to insert everything into the users table.

    The dump file is a 20G big file containing the hole db.
    I havent made the dump file myself so I don't now how it was created.

    Kris

  5. #5
    Join Date
    Feb 2004
    Posts
    492
    The easiest way to copy or move a database, in my opinion, is to detach the database, copy or move it to the new location, then attach it.

    If the dump file does _not_ have an mdf extention I would suspect it's the result of a backup operation. You'll need to restore the file if that is the case. You can backup/restore from the EM, right click 'Databases', choose 'All tasks.. restore'
    (probably restore from a device).

  6. #6
    Join Date
    Dec 2004
    Posts
    10
    I am now trying to restore the db with the EM.
    But I am getting an error, see the atached file 'error1.jpg'

    I have placed the db and the dump file on a drive with 80 GB

    Kris
    Attached Thumbnails Attached Thumbnails error1.jpg  

  7. #7
    Join Date
    Dec 2004
    Posts
    10

    It works

    I finally got it to work, the database was created in the wrong drive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •