Posts Tagged ‘restore’

MySQL ERROR 2006 – server has gone away while restoring.

I was getting the following errors when I was trying to restore a Request Tracker MySQL database in linux (Ubuntu to CentOS).

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect…
Connection id: 10
Current database: rt4

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect…
Connection id: 11
Current database: rt4

ERROR 2006 (HY000): MySQL server has gone away
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect…
Connection id: 12
Current database: rt4

These errors came later in the restore:

ERROR 1231 (42000): Variable ‘time_zone’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘sql_mode’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘foreign_key_checks’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘unique_checks’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘character_set_client’ can’t be set to the value of ‘NULL’
Query OK, 0 rows affected (0.00 sec)

ERROR 1231 (42000): Variable ‘collation_connection’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘sql_notes’ can’t be set to the value of ‘NULL’

To get the database restored, I had to change the maximum allowed packet setting.

The best way to do that is to add the following line to the [mysqld] section of the my.cnf (CentOS: /etc/my.cnf or Ubuntu: /etc/mysql/my.cnf):

max_allowed_packet = 16M

Then, restart your MySQL service.
Ubuntu: service mysql restart
CentOS: service mysqld restart

Now, I did this on both of my servers, then I could use my regular backup script and the setting would be picked up by the my.cnf. However, you can do the backup with option enabled if it is not in your my.cnf by using something like the following:

mysqldump $thedb –user=”myid” –password=”$SQLPWD” –max_allowed_packet=16M > $thedb.sql

Windows System Restore from command line

To run the System Restore from the command line in Safe mode:

Restart the computer and hold down the F8 key while it restarting.

Select the “Safe mode with a Command prompt” option.

Enter in the command prompt:

In Windows XP:
C:\> %systemroot%\system32\restore\rstrui.exe

In Windows 7:
C:\> %systemroot%\system32\rstrui.exe

This is the best way to go back to a different restore point in Windows XP and 7.

Restore MS SQL database from filesystem backup.

I found myself having to restore a Microsoft SQL 2000 database using only a file system backup. I was very cautious about my approach, because I wanted to restore the database to a database with a different name. I did this by using “Attach database …” from Enterprise Manager.

Right mouse click on “Databases”.
Go to “All Tasks”
Then, “Attach Database…”
Browse to MDF file that you restored (MDF and LDF should be restored from file system backup), by clicking the “…” next to the “Verify” button.
Then, database name you want to use for the restored database in the “Attach as” field.
Then, choose the database owner in the “Specify database owner” drop down.

It worked great, and was simple. Of course, I know that I should be doing the restores from a SQL backup, but circumstances came up where that was the only backup I had to work from. I will probably verify this procedure on a more current version of SQL server and update accordingly.

I decided to go from one extreme to the other. I installed SQL Server 2012 RCO to try to restore a database from a file system backup. It is a little different, but basically the same steps.

Right mouse click on “Databases” and click “Attach…”
Click the “Add…” button and add the mdf file you restored.
Then double click the name under the “Attach As” column heading to restore to a database with a different name.
Click “Ok” to finish.

How to repair Dell boot record to access restore partition.

The boot record on a Dell E310 was modified over time as a result of various system updates. I was unable to access the restore partition, when the OS needed to be restored, using Ctrl-F11 at the BIOS boot screen. To restore the boot record so that I could use Ctrl-F11, I created a bootable DOS CD using the fdfullcd.iso from the FreeDOS site (http://www.freedos.org/). Then, I created another CD with the dsrfix.exe (http://www.goodells.net/dellrestore/files/dsrfix.zip) utility on it. I unzipped the dsrfix.zip file and burn the contents of the zip file onto a CD.

From here, I booted the FreeDOS CD. Then, I removed the FreeDOS CD and put in the dsrfix CD. I ran mscdex.exe at this point. However, I do not believe that was necessary. Then, I switched to the E: drive and ran dsrfix. I had an alert on pbr descriptor 3. Next, I ran dsrfix /F. This repaired the record so that Ctrl-F11 worked. Thanks to Dan Goodell (http://www.goodells.net/dellrestore/). According to Dan’s site, his utility has been tested on the following Dell systems: Dimension 1100, 2400, 3000, 3100, 4550, 4600, 4700, 5000, 5100, 5150, 8200, 8300, 8400, 9100, 9150, B110, E310, E510, E520, E521, XPS 400, XPS 410, XPS 720, XPS Gen 4. Inspiron 500m, 510m, 600m, 630m, 640m, 700m, 1150, 1200, 1300, 1501(AMD), 2200, 5100, 5150, 6000, 6400, 8600, 9300, 9400, B120, B130, E1405, E1505, E1705, M710, M1210, XPS, XPS Gen 2, XPS M1710. Vostro 200.

Return top

INFORMATION