The primary server has datafiles in d drive. When I execute the following script use [databasename] go sp_helpfile go It reads that the datafiles are in d drive in secondary server however I do not see any datafiles in d drive of the secondary server. The datafiles are present in c:\\programfiles\\sqlserver.... After restore the datafiles are restored in c:\\programfiles. Is there a way to move the datafiles to d drive in the secondary server while logshipping.
I'm guessing that you used the wizard to restore the database on the remote server to setup the logshipping and that created the files in the default location. I would recommend disabling the restore job, dropping the database and then performing a fresh restore of the backup using the WITH MOVE command to move the files to the location that you want. Then just enable the logshipping restore job once more and you'll be good to go.