Monday, January 30, 2012

Changing IP Address of Cisco AP c1260 Gigabit Interface

Changing IP Address of Cisco AP c1260 Gigabit Interface


Well, I need to put it here so I may not forget, there are still other AP that I have not yet set the IP.


I able to login on enable mode, and the command to configure the IP is..

lwapp ip  or try lwapp ? for the succeeding commands / parameters.






Friday, January 27, 2012

Duplicating a copy of schema to another schema name on an existing postgresql database

Problem: Need to duplicate the content of say schema001 inside a DB name dbtest001 to a new schema with name schema999.


Specs: Postgres 8.2.17


Solution:

1. Login as root, su - postgres

2. create a backup first of the DB dbtest001, command below:
pg_dump -U postgres dbtest001 -f /tmp/dbtest001-backup.sql

3. psql dbtest001

4. We need to rename the schema001 by alter command:
SCHEMA schema001 RENAME TO schema999;

then control d to exit inside psql.

5. After renaming it to the new schema name, dump the database schema only for the particular schema.
pg_dump -U postgres dbtest001 --schema=schema999 --schema-only -f /tmp/schema999.sql

6. Rename back the schema999 to its original name - schema001.

psql dbtest001

SCHEMA schema999 RENAME TO schema001;

7. Now create schema999


CREATE SCHEMA schema999;

control d to exist again from psql console.

8. Now restore the dumped file on the database.
psql -U postgres -d dbtest001 < /tmp/schema999.sql


The schema999 should now been populated with the content of schema001.


-Ohbet


Edit:


01302012

There is a request to do this on a live system, so I cannot rename the schema, and for searching, some mentioned the dump the original schema to a file, rename the schema name on that file to a new name, here im using sed to rename then create the new schema on the DB and restore the dumped file.


1. Of course, create a backup first. - see 1 above


2. Dump the existing schema.
pg_dump -U postgres dbtest001 --schema=schema001 --schema-only -f /tmp/schema001.sql

3. Rename the schema001 entry on that file and dump in on another file named schema999.
sed 's\schema001\schema999\g' /tmp/schema001.sql > /tmp/schema999.sql

4.  psql dbtest001

5. Create the new schema.

CREATE SCHEMA schema999;

6. Dump the edited schema named schema999.sql

psql -U postgres -d dbtest001 < /tmp/schema999.sql


Note: This is the same result as doing the above, the advantage is you dont need to rename the schema, since its a live system.






 

Thursday, January 5, 2012

Fedora 16 boot problem

Problem: When I accidentally hit the recovery boot process of HP540 Laptop, fedora 16 grub menu wiped out. When restarted and cancelled the Recovery process, it will directly boot to XP, no grub menu.

Setup: Dual boot with Windows XP.

Solution:

I have still the copy of Fedora 16 re-imaged on my USB, I boot the laptop using the USB and make the repair from there.

1. Open terminal shell.
2. Do fdisk -l to find out what disk does the laptop has, on mine, its /dev/sda as the main disk.
3. Find the /boot partition, mine is at /dev/sda3 since I created a separate mount for it
4. mount /dev/sda3 /boot - this will mount your actual /boot on the live system.
5. run the command grub2-install /dev/sda
6. reboot, on mine, it successfully restored the grub and able to get back to my fedora 16 system.