How to move indexes from one database to another database??

  • Hi All,

    I created a new database in test server.i moved all tables data from production to UAT by using import/export wizard.The task was completed successfully but the indexes was not created in new database .

    So i want to move all the indexes prod database to test database .

    any one please let me know how can i achieve this ..........

    Thanks

    Lavanya

  • you can script the indexes on one server(db) and run the script inside the other.

  • Lavanyasri (7/26/2012)


    Hi All,

    I created a new database in test server.i moved all tables data from production to UAT by using import/export wizard.

    Thanks

    Lavanya

    is there any reason why you have used import/export instead of DB scripting or DB restore.

    Regards
    Durai Nagarajan

  • Thanks Hadrian .

    Could you please provide the script plz

  • we don't have enough disk space to take the backup in prod. Every day backup is taking by using third aprty tool . So by using this backup file its not possible to restore in Test server .

    So i preferred this option

  • Lavanyasri (7/26/2012)


    we don't have enough disk space to take the backup in prod. Every day backup is taking by using third aprty tool . So by using this backup file its not possible to restore in Test server .

    So i preferred this option

    In that case, I would prefer to generate complete DB script (DDLs only).

    Then, run CREATE TABLE first, export data, run rest of the DDL script(PK,FK,Other objects like SPs,fns,Trgs,....)

    --

    well still you can generate DB script and then execute everything else without CREATE TABLE script

    To generate script: right click DB in SSMS -> Tasks-> Generate Scripts...

  • I tried the below scenario but its not creating indexes.

    generate script: right click DB in SSMS -> Tasks-> Generate Scripts...

  • Lavanyasri (7/26/2012)


    I tried the below scenario but its not creating indexes.

    generate script: right click DB in SSMS -> Tasks-> Generate Scripts...

    Did you make sure "Script Indexes" = true, in script wizard?

  • Thanks ,

    I already created tables in test environment ?Now can i created only indexes in that database ??

  • yes create the table script with "Include if not exists" as yes then table wont be created but index will be created.

    Regards
    Durai Nagarajan

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply