• mike.winter (6/6/2008)


    Hi lester im getting...

    Msg 213, Level 16, State 7, Line 1

    Insert Error: Column name or number of supplied values does not match table definition.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE HEADERONLY is terminating abnormally.

    Msg 213, Level 16, State 7, Line 1

    Insert Error: Column name or number of supplied values does not match table definition.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE FILELIST is terminating abnormally.

    Let me explain the scenario. We restore a Gas database given to us from a, lets say LESS than helpful, 3rd party company. This data is ours, the database is ours but its hosted on their servers (dont even get me started on what i would do if i were in charge of the litigation).

    Anyway they send us a 'copy' of the gas database and we do a manual restore process twice per day. I was trying to use your script to automatically restore this database any ideas on why its failing?

    Cheers

    The reason it is not working is the result set from REQUEST HEADERONLY / FILEONLY is different from the migration and the header table that is created.

    i ran into this problem and I was able to fix it after using the exact column name and data type from those two queries.

    Try replacing migration_lester and header_lester with this one:

    CREATE TABLE migration_lester(

    LogicalName nvarchar(128),

    PhysicalName nvarchar(260),

    type char(1),

    FileGroupName nvarchar(128),

    size numeric(20,0),

    MaxSize numeric(20,0),

    FileID bigint,

    CreateLSN numeric(25,0),

    DropLSN numeric(25,0),

    UniqueID uniqueidentifier,

    ReadOnlyLSN numeric(25,0),

    ReadWriteLSN numeric(25,0),

    BackupSizeInBytes bigint,

    SourceBlockSize int,

    FileGroupID int,

    LogGroupGUID uniqueidentifier,

    DifferentialBaseLSN numeric(25,0),

    DifferentialBaseGUID uniqueidentifier,

    IsReadOnly bit,

    IsPresent bit

    )

    CREATE TABLE header_lester (

    BackupName nvarchar(128) ,

    BackupDescription nvarchar(255),

    BackupType smallint,

    ExpirationDate datetime,

    Compressed tinyint,

    Position smallint,

    DeviceType tinyint,

    UserName nvarchar(128),

    ServerName nvarchar(128),

    DatabaseName nvarchar(128),

    DatabaseVersion int,

    DatabaseCreationDate datetime,

    BackupSize numeric(20,0),

    FirstLsn numeric(25,0),

    LastLsn numeric(25,0),

    CheckpointLsn numeric(25,0),

    DifferentialBackupLsn numeric(25,0),

    BackupStartDate datetime,

    BackupFinishDate datetime,

    SortOrder smallint,

    CodePage smallint,

    UnicodeLocaleid int,

    UnicodeComparisonStyle int,

    CompatibilityLevel tinyint,

    SoftwareVendorId int,

    SoftwareVersionMajor int,

    SoftwareVersionMinor int,

    SoftwareVersionBuild int,

    MachineName nvarchar(128),

    Flags int,

    BindingId uniqueidentifier,

    RecoveryForkId uniqueidentifier,

    Collation nvarchar(128),

    FamilyGUID uniqueidentifier,

    HasBulkLoggedData bit,

    IsSnapshot bit,

    IsReadOnly bit,

    IsSingleUser bit,

    HasBackupChecksums bit,

    IsDamaged Int,

    BeginsLogChain bit,

    HAsIncompleteMetaData bit,

    IsForceOFfline bit,

    IsCopyOnly bit,

    FirstRecoveryForkID uniqueidentifier,

    ForkPointLSN numeric(25,0),

    RecoveryModel nvarchar(60),

    DifferentialBaseLSN numeric(25,0),

    DifferentialBAseGUID uniqueidentifier,

    BackupTypeDescription nvarchar(60),

    BackupSetGUID uniqueidentifier

    )