Make the following modifications to turn the front LED green when the boot process is completed and turn the LED off when it's save to unplug the PogoPlug.
1. Install a kernel with LED support onto the PogoPlug.
Instructions here: Linux Kernel 3.12.0 Kirkwood package ...
I installed Kernel 3.12.0, which is the latest at the moment.
2. edit /etc/rc.local
add these lines:
echo none > sys/class/leds/status\:orange\:fault/trigger
echo default-on > sys/class/leds/status\:green\:health/trigger
* this will turn off the orange LED and turn on the green LED
2a. to show network traffic by blinking the orange LED:
#Set up orange LED to blink on incoming TCP traffic
iptables -A INPUT -p tcp -j LED --led-trigger-id tcpin --led-delay 100
echo netfilter-tcpin > /sys/class/leds/status\:orange\:fault/trigger
(Note: might have to install iptables with apt-get install iptables)
3. edit /etc/init.d/halt
add this line BEFORE "halt -d -f $netdown ...":
echo none > sys/class/leds/status\:green\:health/trigger
(Note: in the instructions here it says to add the line AFTER the "halt" line but that did not work for me. It seems execution stops at the "halt" line an dsubsequent code is not executed.)
(Note2: if you see an LED called "status:blue:health" in /sys/class/leds then your PogoPlug is not properly recognized and the machine is running as a SheevaPlug. You might need to set the environment:
fw_setenv machid dd6
details are here.
Monday, December 23, 2013
Saturday, December 21, 2013
PogoPlug E02 - move Debian to larger USB drive
USB drives are getting bigger and cheaper. Here are the steps I used ot move my Debian Wheezy installation from a 4GB USB drive to an 8GB USB drive.
1. partition the new drive the same way the existing one is partitioned
* use fdisk for this step
* this can be done on the PogoPlug or on another Linux computer
* e.g. 3.5GB root partition (ext2) and 500MB swap partition
* Note: this could have been done with GParted as well
2. on another Linux computer format the new USB drive partitions as ext2 and linux-swap respectively
* I used GParted for this
3. on another Linux computer, copy the old drive to the new drive using rsync
* plug in both drives into your Linux machine
* mount both drives
* as root in a terminal window:
rsync -av /media/USBCurrent/ /media/USBNew/
(make sure to use the correct mount folders, careful to list the SOURCE first)
* unmount both drives
4. check installation
* plug new USB drive into PogoPlug
* power on PogoPlug
* wait for system to boot, should show up under the same name/IP as the old one
5. expand the root partition to the larger size
* shut down PogoPlug
* unplug new USB drive
* plug new USB drive into Linux computer
* with GParted move the swap partition to the end of the drive and resize the root partition as needed
6.Boot up PogoPlug
* plug new USB drive back into the PogoPlug and power on PogoPlug
7. The UUID for the swap partition might have changed since using GParted to move/resize the swap partition.
If you issue the "top" command and under "KiB Swap" it shows 0, you have to fix this:
List the known UUIDs:
blkid -c /dev/null
Check fstab:
cat /etc/fstab
If the UUID in fstab for the line containing the swap partition does not match the UUID from the blkid output do this:
- edit fstab to change the swap partition line to the correct UUID, then save fstab
- swapon -a to enable the swap partition
check if the change worked, issue the "top" command and check at the top under "KiB Swap".
1. partition the new drive the same way the existing one is partitioned
* use fdisk for this step
* this can be done on the PogoPlug or on another Linux computer
* e.g. 3.5GB root partition (ext2) and 500MB swap partition
* Note: this could have been done with GParted as well
2. on another Linux computer format the new USB drive partitions as ext2 and linux-swap respectively
* I used GParted for this
3. on another Linux computer, copy the old drive to the new drive using rsync
* plug in both drives into your Linux machine
* mount both drives
* as root in a terminal window:
rsync -av /media/USBCurrent/ /media/USBNew/
(make sure to use the correct mount folders, careful to list the SOURCE first)
* unmount both drives
4. check installation
* plug new USB drive into PogoPlug
* power on PogoPlug
* wait for system to boot, should show up under the same name/IP as the old one
5. expand the root partition to the larger size
* shut down PogoPlug
* unplug new USB drive
* plug new USB drive into Linux computer
* with GParted move the swap partition to the end of the drive and resize the root partition as needed
6.Boot up PogoPlug
* plug new USB drive back into the PogoPlug and power on PogoPlug
7. The UUID for the swap partition might have changed since using GParted to move/resize the swap partition.
If you issue the "top" command and under "KiB Swap" it shows 0, you have to fix this:
List the known UUIDs:
blkid -c /dev/null
Check fstab:
cat /etc/fstab
If the UUID in fstab for the line containing the swap partition does not match the UUID from the blkid output do this:
- edit fstab to change the swap partition line to the correct UUID, then save fstab
- swapon -a to enable the swap partition
check if the change worked, issue the "top" command and check at the top under "KiB Swap".
Friday, December 20, 2013
PogoPlug E02 - Install Debian
I got myself another cheap PogoPlug E02 from Adorama . It is sold as a model P21, but I actually got the E02, which is nicer (better processor, more RAM).
Steps to install Debian Linux on the PogoPlug
0. start up the PogoPlug, no drives attached
1. SSH into the PogoPlug (default password: ceadmin)
2. Disable the PogoPlug Service
killall hbwd
3. install newer UBOOT as per instructions here: http://projects.doozan.com/uboot/
- select to disable the PogoPlug service
- set the arcNumber to 3542 as per here: http://archlinuxarm.org/forum/viewtopic.php?t=2780
/usr/sbin/fw_setenv arcNumber 3542
4. plug in USB drive
5. partition the USB drive with fdisk
- if fdisk gives "command not found" execute directly from /usr/sbin (this might also be in /sbin)
cd /usr/sbin
./fdisk /dev/sda
- fdisk usage
6. DOES NOT WORK: Install Debian Wheezy (7.0)
- Follow instructions from Jeff Doozan's site: http://projects.doozan.com/debian/ use Debian 7.0 (Wheezy)
cd /tmp
wget http://projects.doozan.com/debian/kirkwood.debian-wheezy.sh
chmod +x kirkwood.debian-wheezy.sh
export PATH=$PATH:/usr/sbin:/sbin
./kirkwood.debian-wheezy.sh
wait ...... (this may take some time)
Major Complications: I ran into the following error:
FATAL: Kernel too old in debootstrap
- tried to install rescue system, but you cannot install that from the device itself, needs to be booted from USB
- created USB boot drive with rescue system 3.0 (http://forum.doozan.com/read.php?4,8277) .. BUT from there you CANNOT seem to install the rescue system V2 into NAND - it says uBoot is outdated even though it's the latest version
After a lot of unsuccessful attempts went the following route:
1. install Debian Squeeze
Follow the instructions here: https://sites.google.com/site/leiqincwru/pogoplus/install-debian-squeeze-on-pogoplug-e02
(The regular instructions are here, but the above link has additional commands to be executed for the PogoPlug).
This is important for PogoPlug:
2. install rescue system 2.8.2
* link: http://forum.doozan.com/read.php?4,7915
* copied files to the debian system installed under #1
* install mtd-utils if flash_eraseall is not found (apt-get install mtd-utils)
* manual install
3. upgrade from Squeeze to Wheezy - described here (http://blog.vinnymac.org/?p=11)
Finally. Success.
4. Optional:
* update to a newer 3.x kernel from the following link: http://forum.doozan.com/read.php?2,12096
Note: apt-get upgrade might complain about half-installed packages because we manually installed the new kernel. In that case manually edit /var/lib/dpkg/status file and change "half-configured" to "installed". See here: http://ubuntuforums.org/showthread.php?t=1547998
Note2: after that there was still an error message about a "Configured-Version for package with inappropriate Status" - there was a line in the status file called "Config-Version". After it deleted that line the error went away.
5. Change the sources to the proper wheezy sources
vim /etc/apt/sources.list
add these lines, comment the others:
deb http://http.debian.net/debian wheezy main contrib non-free
deb http://http.debian.net/debian wheezy-updates main contrib non-free
6. Update your system
apt-get update
apt-get upgrade
7. Configure timezone
dpkg-reconfigure tzdata
Steps to install Debian Linux on the PogoPlug
0. start up the PogoPlug, no drives attached
1. SSH into the PogoPlug (default password: ceadmin)
2. Disable the PogoPlug Service
killall hbwd
3. install newer UBOOT as per instructions here: http://projects.doozan.com/uboot/
- select to disable the PogoPlug service
- set the arcNumber to 3542 as per here: http://archlinuxarm.org/forum/viewtopic.php?t=2780
/usr/sbin/fw_setenv arcNumber 3542
4. plug in USB drive
5. partition the USB drive with fdisk
- if fdisk gives "command not found" execute directly from /usr/sbin (this might also be in /sbin)
cd /usr/sbin
./fdisk /dev/sda
- fdisk usage
- p to show your current partitions
- d 1 to delete your first partition, and if necessary d 2, d 3, and so on
- p again to make sure there are no partitions left
- n for new partition, p for primary, 1 for partition 1, enter to accept the default starting point, and then +(size)M to size it. I used a 2 GB drive, so I put +1536M for 1.5 GB
- n, p, 2, enter, enter to create a swap partition out of the rest. Ideally you won't need a swap partition at all (we're going to try to avoid it), but better safe than sorry.
- t to change filesystem types, 2 for the second partition, and 82 for swap.
- a, 1 to set partition 1 as active/bootable
- p one last time to make sure everything looks okay. Once again, fdisk hasn't done anything to the drive yet, so if you see a mistake, you can either start over or fix it if you know what needs to be done.
- And finally, w to write the partition table to disk and exit.
6. DOES NOT WORK: Install Debian Wheezy (7.0)
- Follow instructions from Jeff Doozan's site: http://projects.doozan.com/debian/ use Debian 7.0 (Wheezy)
cd /tmp
wget http://projects.doozan.com/debian/kirkwood.debian-wheezy.sh
chmod +x kirkwood.debian-wheezy.sh
export PATH=$PATH:/usr/sbin:/sbin
./kirkwood.debian-wheezy.sh
wait ...... (this may take some time)
Major Complications: I ran into the following error:
FATAL: Kernel too old in debootstrap
- tried to install rescue system, but you cannot install that from the device itself, needs to be booted from USB
- created USB boot drive with rescue system 3.0 (http://forum.doozan.com/read.php?4,8277) .. BUT from there you CANNOT seem to install the rescue system V2 into NAND - it says uBoot is outdated even though it's the latest version
After a lot of unsuccessful attempts went the following route:
1. install Debian Squeeze
Follow the instructions here: https://sites.google.com/site/leiqincwru/pogoplus/install-debian-squeeze-on-pogoplug-e02
(The regular instructions are here, but the above link has additional commands to be executed for the PogoPlug).
This is important for PogoPlug:
./mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e
0x00008000 -n Linux-2.6.32-5-kirkwood -d
../../boot/vmlinuz-2.6.32-5-kirkwood ../../boot/uImage
./mkimage
-A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n
initramfs-2.6.32-5-kirkwood -d ../../boot/initrd.img-2.6.32-5-kirkwood
../../boot/uInitrd
2. install rescue system 2.8.2
* link: http://forum.doozan.com/read.php?4,7915
* copied files to the debian system installed under #1
* install mtd-utils if flash_eraseall is not found (apt-get install mtd-utils)
* manual install
flash_eraseall /dev/mtd1 nandwrite /dev/mtd1 uImage-mtd1.img flash_eraseall /dev/mtd2 ubiformat /dev/mtd2 -s 512 -f rootfs-mtd2.img -y fw_setenv set_bootargs_rescue 'setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts' fw_setenv bootcmd_rescue 'run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000' fw_setenv bootcmd_pogo 'run bootcmd_rescue' fw_setenv rescue_installed 1
3. upgrade from Squeeze to Wheezy - described here (http://blog.vinnymac.org/?p=11)
Finally. Success.
4. Optional:
* update to a newer 3.x kernel from the following link: http://forum.doozan.com/read.php?2,12096
Note: apt-get upgrade might complain about half-installed packages because we manually installed the new kernel. In that case manually edit /var/lib/dpkg/status file and change "half-configured" to "installed". See here: http://ubuntuforums.org/showthread.php?t=1547998
Note2: after that there was still an error message about a "Configured-Version for package with inappropriate Status" - there was a line in the status file called "Config-Version". After it deleted that line the error went away.
5. Change the sources to the proper wheezy sources
vim /etc/apt/sources.list
add these lines, comment the others:
deb http://http.debian.net/debian wheezy main contrib non-free
deb http://http.debian.net/debian wheezy-updates main contrib non-free
6. Update your system
apt-get update
apt-get upgrade
7. Configure timezone
dpkg-reconfigure tzdata
Wednesday, December 1, 2010
Seagate Dockstar - Install Debian Linux
Step 1: Disable the Pogoplug services
- SSH into the DockStar
- command: "killall hbwd"
Step 2: Attach and configure the USB device
- use fdisk (instructions here)
- create 2 partitions: 1st partition type 83 (Linux), second partition type 82 (Linux Swap)
- mark partition 1 as bootable
Step 3: Install Debian Linux
- use instructions here
- this will take a while, after it is finished it will ask you to reboot
- log back in using SSH (PuTTY)
- change the host name by editing the file "/etc/hostname" using vi or nano
- set the timezone by using "dpkg-reconfigure tzdata"
- optionally, install an updated Kernel from here
Step 4: Additional Configuration
- install nano editor "apt-get install nano"
- install sudo with "apt-get install sudo"
- add additional users with "adduser"
- install other packages for internet radio, samba, I2C etc. (will be covered in later posts)
Step 5: make a copy/backup of your system
If you have the system configured and running, you can make a backup copy onto another USB stick with the following command:
This assumes that the boot USB drive is /dev/sda and the traget drive is /dev/sdb
ALL DATA ON /dev/sdb WILL BE ERASED!
Related links:
DIY Audio - hackable linux (openWRT) ethernet board
http://www.mikrocontroller.net/articles/Dockstar
http://ahsoftware.de/dockstar/
http://www.rudiswiki.de/wiki/DockStarDebian
Ten(ish) steps to setting up a Seagate Dockstar
http://anwendungsentwickler.ws/dockstar_freeagent_bekommt_zuwachs/entry/316/
- SSH into the DockStar
- command: "killall hbwd"
Step 2: Attach and configure the USB device
- use fdisk (instructions here)
- create 2 partitions: 1st partition type 83 (Linux), second partition type 82 (Linux Swap)
- mark partition 1 as bootable
Step 3: Install Debian Linux
- use instructions here
- this will take a while, after it is finished it will ask you to reboot
- log back in using SSH (PuTTY)
- If the device does not boot into your new Debian install, you maye have a USB stick that is not suitable for booting from it. Try a "warm boot" by using a pen to push the "Reset" button on the right side of the DockStar.).
- The device may have a different IP address now (check that using your router)
- to troubleshoot you can use netconsole as described here
- change the host name by editing the file "/etc/hostname" using vi or nano
- set the timezone by using "dpkg-reconfigure tzdata"
- optionally, install an updated Kernel from here
Step 4: Additional Configuration
- install nano editor "apt-get install nano"
- install sudo with "apt-get install sudo"
- add additional users with "adduser"
- install other packages for internet radio, samba, I2C etc. (will be covered in later posts)
Step 5: make a copy/backup of your system
If you have the system configured and running, you can make a backup copy onto another USB stick with the following command:
dd if=/dev/sda of=/dev/sdb
This assumes that the boot USB drive is /dev/sda and the traget drive is /dev/sdb
ALL DATA ON /dev/sdb WILL BE ERASED!
Related links:
DIY Audio - hackable linux (openWRT) ethernet board
http://www.mikrocontroller.net/articles/Dockstar
http://ahsoftware.de/dockstar/
http://www.rudiswiki.de/wiki/DockStarDebian
Ten(ish) steps to setting up a Seagate Dockstar
http://anwendungsentwickler.ws/dockstar_freeagent_bekommt_zuwachs/entry/316/
Tuesday, December 16, 2008
VB.Net and Optional Parameters - watch out!
I read somewhere recently that C# 4.0 will also have optional parameters, like VB6 and VB.Net had all along.
When moving to .Net I decided not to use optional parameters in VB.net since they were kind of looked at as a remnant of VB6, not CLR compliant, not available in C# etc.
And the "preferred way" was to use overloads instead of Optional Parameters.
So now after I read that C# 4.0 will have optional parameters (and the fact that I am kind of "over" the many overloads that are sometimes necessary, especially if you have logging methods etc.) I was thinking of going back to using Optional Parameters.
I always assumed that the compiler for VB.Net would just created the overloads in the background, substituting it with the default values given to the Optional Parameters.
But that is not the case. The compile hard-compiles the default values into the CALLING method/object and not as an overload into the called method.
Joel On Software
VB.NET Optional parameters
Optional Parameters (VB.NET)
Now this was a big red flag for me, because that means each time you change the value of one of the default parameters, you would need to recompile ALL the CALLING classes as well (if they call with some of the optional parameters omitted).
So if you have a live enterprise system with multiple DLLs and you need to deploy hotfixes as individual DLLs then you'd have to deploy the changed DLL and all the DLLs that call it. Otherwise the "old" DLLs will still call your method with the "old" default value and this could introduce some hard-to-find side effects.
One might argue how often do you really need to change the default value of an Optional Parameter and that that indicates a deeper design issue.
But still, for complex system or legacy code that you are refactoring this might be a real possibility.
Furthermore in VB.Net 3.5 you cannot use Nullable types as optional parameters, i.e. you cannot do this:
Public Sub DoStuff(Optional ByVal intEntityID As Nullable(Of Integer) = Nothing)
End Sub
So my conclusion at this point is to stick with overloads instead of Optional Parameters. More predictable and less things to remember as possible pitfalls. :)
I got enough other stuff to cram into my head ...
When moving to .Net I decided not to use optional parameters in VB.net since they were kind of looked at as a remnant of VB6, not CLR compliant, not available in C# etc.
And the "preferred way" was to use overloads instead of Optional Parameters.
So now after I read that C# 4.0 will have optional parameters (and the fact that I am kind of "over" the many overloads that are sometimes necessary, especially if you have logging methods etc.) I was thinking of going back to using Optional Parameters.
I always assumed that the compiler for VB.Net would just created the overloads in the background, substituting it with the default values given to the Optional Parameters.
But that is not the case. The compile hard-compiles the default values into the CALLING method/object and not as an overload into the called method.
Joel On Software
VB.NET Optional parameters
Optional Parameters (VB.NET)
Now this was a big red flag for me, because that means each time you change the value of one of the default parameters, you would need to recompile ALL the CALLING classes as well (if they call with some of the optional parameters omitted).
So if you have a live enterprise system with multiple DLLs and you need to deploy hotfixes as individual DLLs then you'd have to deploy the changed DLL and all the DLLs that call it. Otherwise the "old" DLLs will still call your method with the "old" default value and this could introduce some hard-to-find side effects.
One might argue how often do you really need to change the default value of an Optional Parameter and that that indicates a deeper design issue.
But still, for complex system or legacy code that you are refactoring this might be a real possibility.
Furthermore in VB.Net 3.5 you cannot use Nullable types as optional parameters, i.e. you cannot do this:
Public Sub DoStuff(Optional ByVal intEntityID As Nullable(Of Integer) = Nothing)
End Sub
So my conclusion at this point is to stick with overloads instead of Optional Parameters. More predictable and less things to remember as possible pitfalls. :)
I got enough other stuff to cram into my head ...
Thursday, November 13, 2008
HTTP concurrent connections from IE - AJAX
I have been stumbling across articles about the two-concurrent-connection limit of IE7 recently.
Tools like the Visual Round Trip Analyzer from Microsoft also mention this in the set of criteria they evaluate against.
It seems that in IE8 the limit of 2 connections is increased to 6 as per here:
AJAX - Connectivity Enhancements in Internet Explorer 8
But it can also be tweaked in IE7 and below as decsribed in the KB article:
http://support.microsoft.com/kb/183110
Other links:
12 Steps To Faster Web Pages With Visual Round Trip Analyzer
Case Study: Much ado about Browser's HTTP connection
Tools like the Visual Round Trip Analyzer from Microsoft also mention this in the set of criteria they evaluate against.
It seems that in IE8 the limit of 2 connections is increased to 6 as per here:
AJAX - Connectivity Enhancements in Internet Explorer 8
But it can also be tweaked in IE7 and below as decsribed in the KB article:
http://support.microsoft.com/kb/183110
Other links:
12 Steps To Faster Web Pages With Visual Round Trip Analyzer
Case Study: Much ado about Browser's HTTP connection
Friday, November 7, 2008
Nested JOINS (mix of inner and outer joins in SQL)
I just ran into this today:
Be Careful When Mixing INNER and OUTER Joins
It's not rocket science, but it can be somewhat counter-intuitive. How to tell the SQL server query engine what you want as an inner join vs an outer join.
I ended up using the nested join syntax by the way, seems cleanest to me and is not relying on the position of the JOIN line in the query.
Basically:
Be Careful When Mixing INNER and OUTER Joins
It's not rocket science, but it can be somewhat counter-intuitive. How to tell the SQL server query engine what you want as an inner join vs an outer join.
I ended up using the nested join syntax by the way, seems cleanest to me and is not relying on the position of the JOIN line in the query.
Basically:
select People.PersonName, Pets.PetName, PetTypes.PetType
from People
left outer join
(Pets inner join PetTypes on Pets.PetTypeID = PetTypes.PetTypeID)
on Pets.OwnerID = People.PersonID
Monday, November 3, 2008
Stored Procedures - Best Practices
Excellent post where Aaron Bertrand shares his best practices for developing stored procedures covering both coding style as well as some coding best practices (good use of NOCOUNT etc).
http://sqlblog.com/blogs/aaron_bertrand/archive/2008/10/30/my-stored-procedure-best-practices-checklist.aspx
http://sqlblog.com/blogs/aaron_bertrand/archive/2008/10/30/my-stored-procedure-best-practices-checklist.aspx
Windows Azure - behold the cloud
A lot of buzz is being generated at the moment about the Microsoft Azure Services platform. Here is a brief collection of links to get started on it.
Microsoft’s official Azure site, containing links to the key parts of the platform and documentation:
http://www.microsoft.com/azure/default.mspx
Microsoft's official press release:
http://www.microsoft.com/presspass/press/2008/oct08/10-27PDCDay1PR.mspx
Overview blog post by Paul Gielens:
http://weblogs.asp.net/pgielens/archive/2008/10/27/a-lap-around-windows-azure.aspx
Some details on how the Windows Azure back end infrastructure is laid out:
http://blogs.msdn.com/domgreen/archive/2008/10/30/windows-azure-back-end.aspx
Getting Started with Windows Azure - The Cloud Computing Tools Team has a nice post gathering together the downloads, tools and some information about the tools and SDK:
http://blogs.msdn.com/cloud/archive/2008/10/27/getting-started-windows-azure-tools-for-microsoft-visual-studio.aspx
Here's a tutorial on the process of storing information in Azure with plenty of screenshots and code samples included in the post:
http://blogs.msdn.com/jnak/archive/2008/10/29/walkthrough-simple-blob-storage-sample.aspx
A tutorial on the process of getting up and running with Azure, from setting up the development environment to publishing your first application:
http://blogs.msdn.com/olavt/archive/2008/10/30/how-to-create-and-publish-your-first-windows-azure-application.aspx
Clemens Vasters blogs about the Microsoft .Net ServiceBus that is part of the Azure platform:
http://vasters.com/clemensv/PermaLink,guid,92d78bee-2cfd-4a29-95ab-c5abb9b905e7.aspx
Microsoft’s official Azure site, containing links to the key parts of the platform and documentation:
http://www.microsoft.com/azure/default.mspx
Microsoft's official press release:
http://www.microsoft.com/presspass/press/2008/oct08/10-27PDCDay1PR.mspx
Overview blog post by Paul Gielens:
http://weblogs.asp.net/pgielens/archive/2008/10/27/a-lap-around-windows-azure.aspx
Some details on how the Windows Azure back end infrastructure is laid out:
http://blogs.msdn.com/domgreen/archive/2008/10/30/windows-azure-back-end.aspx
Getting Started with Windows Azure - The Cloud Computing Tools Team has a nice post gathering together the downloads, tools and some information about the tools and SDK:
http://blogs.msdn.com/cloud/archive/2008/10/27/getting-started-windows-azure-tools-for-microsoft-visual-studio.aspx
Here's a tutorial on the process of storing information in Azure with plenty of screenshots and code samples included in the post:
http://blogs.msdn.com/jnak/archive/2008/10/29/walkthrough-simple-blob-storage-sample.aspx
A tutorial on the process of getting up and running with Azure, from setting up the development environment to publishing your first application:
http://blogs.msdn.com/olavt/archive/2008/10/30/how-to-create-and-publish-your-first-windows-azure-application.aspx
Clemens Vasters blogs about the Microsoft .Net ServiceBus that is part of the Azure platform:
http://vasters.com/clemensv/PermaLink,guid,92d78bee-2cfd-4a29-95ab-c5abb9b905e7.aspx
Tuesday, August 5, 2008
Copy data between 2 SQL servers - Take 2
Alright, so one of the issues my previous post did not address was the treatment of Identity columns when using BCP and BULK import.
By default, identity column data is not part of a BCP export, so when doing a BULK IMPORT SQL server will assign new values to the identity Column .
Fortunately, that is relatively easy to address, as decribed here:
http://msdn.microsoft.com/en-us/library/ms186335.aspx
Basically when doing a BCP export, add the "-E" parameter.
Example:
bcp Northwind.dbo.Authors out C:\Temp\DataExport.dat -n -E -T -S MPDESKTOP\SQL2005
And when importing, use the KEEPIDENTITY parameter in the BULK INSERT like this:
USE Northwind
GO
BULK INSERT Authors
FROM 'G:\Transfer\Tempfiles\DataExport.dat'
WITH (KEEPIDENTITY, DATAFILETYPE='native');
GO
This will preserve the values of identity columns when copying data between 2 servers/databases. Keep in mind that there still might be issue with referential integrity constraints etc. that you need to address when moving data between databases.
By default, identity column data is not part of a BCP export, so when doing a BULK IMPORT SQL server will assign new values to the identity Column .
Fortunately, that is relatively easy to address, as decribed here:
http://msdn.microsoft.com/en-us/library/ms186335.aspx
Basically when doing a BCP export, add the "-E" parameter.
Example:
bcp Northwind.dbo.Authors out C:\Temp\DataExport.dat -n -E -T -S MPDESKTOP\SQL2005
And when importing, use the KEEPIDENTITY parameter in the BULK INSERT like this:
USE Northwind
GO
BULK INSERT Authors
FROM 'G:\Transfer\Tempfiles\DataExport.dat'
WITH (KEEPIDENTITY, DATAFILETYPE='native');
GO
This will preserve the values of identity columns when copying data between 2 servers/databases. Keep in mind that there still might be issue with referential integrity constraints etc. that you need to address when moving data between databases.
Subscribe to:
Posts (Atom)