Archive for the 'Databases' Category ¾ÆÄ«À̺ê 'µ¥ÀÌÅͺ£À̽º'ºÐ·ù¿¡ ´ëÇÑ

How to Rename or Move Oracle Tablespace Datafile to Another Location ¾î¶»°Ô À̸§À» ¹Ù²Ù°Å³ª ´Ù¸¥ À§Ä¡·Î À̵¿ Oracle Å×À̺í Datafile

Saturday, August 4th, 2007 Åä¿äÀÏ, 8 ¿ù 4, 2007

Oracle database does not provide an easy user interface to rename a datafile of tablespace, nor database administrator can easily move or relocate the datafile to another location or directory that different from original location on creation of database. ¿À¶óŬ µ¥ÀÌÅͺ£À̽º Å×À̺íÀÇ À̸§À» ¹Ù²Ù·Á¸é datafile ¾ÊÀ¸¸ç, µ¥ÀÌÅͺ£À̽º °ü¸®ÀÚ°¡ ½±°Ô À̵¿ÇÒ ¼öÀÖ½À´Ï´Ù ¶Ç´Â ´Ù¸¥ À§Ä¡ ¶Ç´Â µð·ºÅ͸® µ¥ÀÌÅͺ£À̽ºÀÇ »ý¼º¿¡ ¿ø·¡ À§Ä¡¿¡¼­ ´Ù¸¥¿¡°Ô datafile ¿Å°Ü³õ ½¬¿î »ç¿ëÀÚ ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÇÏÁö ¾Ê½À´Ï´Ù. The rename or move place task has to be performed via Oracle SQLPlus command line interface. ÀÛ¾÷ Àå¼ÒÀÇ À̸§À» ¹Ù²Ù°Å³ª À̵¿ SQLPlus ¿À¶óŬ Ä¿¸Çµå ¶óÀÎ ÀÎÅÍÆäÀ̽º¸¦ ÅëÇØ ¼öÇàÇÒ ¼öÀÖ´Ù. However, if the operation is performed when the tablespace which owns the datefile is online, error will occur. ±×·¯³ª ÀÛÀüÀ» ¼öÇàÇÏ´Â °æ¿ì´Â datefile ¶§ Å×À̺íÀ» ¼ÒÀ¯ÇÏ°í ¿Â¶óÀÎ »óÅÂÀÔ´Ï´Ù, ¿À·ù°¡ ¹ß»ýÇÒ °ÍÀÔ´Ï´Ù.

Continue reading How to Rename or Move Oracle Tablespace Datafile to Another Location » » » °è¼Ó ÀÐ°í ¾î¶»°Ô À̸§À» ¹Ù²Ù°Å³ª ´Ù¸¥ À§Ä¡»»»¿¡ Oracle Å×À̺í Datafile À̵¿


How Drop Tablespace and Recover Oracle Database When Accidentally Delete Datafile Å×ÀÌºí ¹× Oracle µ¥ÀÌÅͺ£À̽º¸¦ º¹±¸ÇÏ´Â ¹æ¹ý ¶§ µå·Ó ½Ç¼ö·Î »èÁ¦ Datafile

Saturday, August 4th, 2007 Åä¿äÀÏ, 8 ¿ù 4, 2007

Accident may happens, even though it¡¯s costly one. »ç°íÀÖ½À´Ï´Ù, ÀÏÀÌÀ־ ºñ¿ëÀÌ ¸¹ÀÌ µå´Â »ý°¢Àº. This is especially the case in Oracle database, which stores the database objects physically in data files on hard disk. ƯÈ÷ À°Ã¼ÀûÀ¸·Î µ¥ÀÌÅÍ ÆÄÀÏÀÌ ÇÏµå µð½ºÅ©¿¡ÀÖ´Â µ¥ÀÌÅͺ£À̽º °³Ã¼¸¦ ÀúÀåÇÏ´Â ¿À¶óŬ µ¥ÀÌÅͺ£À̽º¿¡ÀÖ´Â °æ¿ìÀÔ´Ï´Ù. Fast hand administrators may accidentally delete some of the datafiles, or the datafiles may get corrupted or unreadable on hard disk failure. ¼ÕÀ» »¡¸® °ü¸®ÀÚ°¡ ½Ç¼ö·Î ¾òÀ» ¼öÀÖ´Â ¸î °¡Áö µ¥ÀÌÅÍ, ¶Ç´Â »èÁ¦ÇÒ ¼öÀÖ½À´Ï´Ù µ¥ÀÌÅÍÀÇ ¼Õ»óÀ̳ª ÇÏµå µð½ºÅ©¸¦ ÀÐÀ» ¼öÀÖ´Ù. You may get also some missing datafiles after database recovery process. ¶ÇÇÑ µ¥ÀÌÅͺ£À̽º¸¦ º¹±¸ÇÏ´Â °úÁ¤ ÈÄ ÀϺΠ´©¶ôµÈ µ¥ÀÌÅ͸¦ ¾òÀ» ¼öÀÖ½À´Ï´Ù. In any case, missing a or a few datafiles will cause Oracle database to fail to startup, rendering the whole DB inaccessible. ¾î¶² °æ¿ì¿¡´Â, ´©¶ô ¶Ç´Â ¸î °¡Áö µ¥ÀÌÅ͸¦ ½ÃÀÛ ½ÇÆÐÇϰí, Àüü DB¸¦ ¾×¼¼½ºÇÒ ¼ö ¾ø°Ô ·»´õ¸µ Oracle µ¥ÀÌÅͺ£À̽º°¡ ¹ß»ýÇÒ °ÍÀÔ´Ï´Ù.

Continue reading How Drop Tablespace and Recover Oracle Database When Accidentally Delete Datafile » » » °è¼Ó ÀÐ¾î ³»·ÁÇÏ´Â ¹æ¹ý º¹±¸ ¿À¶óŬ µ¥ÀÌÅͺ£À̽º Å×À̺í°ú ½Ç¼ö·Î »èÁ¦ÇßÀ» ¶§ Datafile»»»

How to Remove and Drop Datafiles from Tablespace in Oracle Database ¾î¶»°Ô ³»·Á Datafiles Á¦°ÅÇÏ°í ¿À¶óŬ µ¥ÀÌÅͺ£À̽º Å×ÀÌºí¿¡¼­

Saturday, August 4th, 2007 Åä¿äÀÏ, 8 ¿ù 4, 2007

Oracle RDBMS databases stores data logically in the form of tablespaces and physically in the form of data files. µ¥ÀÌÅÍ ÆÄÀÏÀÇ ÇüÅ·Π³í¸®ÀûÀ¸·Î ¿À¶óŬÀÇ RDBMS¸¦ µ¥ÀÌÅͺ£À̽º Å×À̺íÀÇ ÇüÅ·ΠÀúÀåÇÏ´Â µ¥ÀÌÅÍ ¹× À°Ã¼Àû. The datafiles are added to the tablespaces as database space requirement grows bigger. µ¥ÀÌÅͺ£À̽º °ø°£ ¿ä±¸ »çÇ×Àº µ¥ÀÌÅÍ Å×ÀÌºí¿¡ ´õ Å« ¼ºÀåÀ¸·Î Ãß°¡µË´Ï´Ù. However, there are several reasons you may want to remove or delete data files from a tablespace. ±×·¯³ª, °Å±â¸¦ Á¦°ÅÇϰųª Å×ÀÌºí¿¡¼­ µ¥ÀÌÅÍ ÆÄÀÏÀ» »èÁ¦ÇÒ ¼öÀÖ½À´Ï´Ù ¸î °¡Áö ÀÌÀ¯°¡ÀÖ½À´Ï´Ù. Such as accidentally add a wrongly sized or unwanted datafile to a tablespace, or the data space usage has became smaller and some data files want to be removed, or attempt to recover Oracle database which fails to start due to missing or corrupted datafiles by removing them, Oracle does not provide an easy way or user interface to delete or drop datafiles from a tablespace. ½Ç¼ö·Î À߸øÇϰųª Å×À̺í, ¶Ç´Â µ¥ÀÌÅÍ °ø°£ »ç¿ëÀ» ¿øÄ¡ ¾Ê´Â datafile ¹× ÀÛ¾Æ ÀϺΠµ¥ÀÌÅÍ ÆÄÀÏÀ» Á¦°Å ÇÒ ¼öµµ ÀÖ°í ¶Ç´Â ½Ãµµ´Â ±×µéÀ» Á¦°ÅÇÔÀ¸·Î½á°Å³ª ¼Õ»óµÈ µ¥ÀÌÅÍ ´©¶ôÀ¸·Î ÀÎÇØ ½ÇÆÐ¸¦ ½ÃÀÛ Oracle µ¥ÀÌÅͺ£À̽º¸¦ º¹±¸ÇÏ·Á¸é Ãß°¡·Î °°Àº Å©±âÀÇ ¿À¶óŬÀº Å×ÀÌºí¿¡¼­ µ¥ÀÌÅ͸¦ »èÁ¦Çϰųª µå·Ó ½¬¿î ¹æ¹ýÀ̳ª »ç¿ëÀÚ ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÇÏÁö ¾Ê½À´Ï´Ù. Once a datafile is made part of a tablespace, it can no longer be detached or removed from the tablespace, albeit there are several workarounds. ÀÏ´Ü datafile a Å×À̺íÀÇ ÇÑ ºÎºÐÀÌ´Ù, ±×°ÍÀ» ´õ ÀÌ»ó ºÐ¸®ÇÒ ¼ö ¾ø°Å³ª Å×ÀÌºí¿¡¼­ Á¦°Å, <½ÎÀÌ º¸±×Áö¸¸ ¸î °¡Áö ÇØ°á ¹æ¹ýÀÔ´Ï´Ù.

Continue reading How to Remove and Drop Datafiles from Tablespace in Oracle Database » » » ¿À¶óŬ µ¥ÀÌÅͺ£À̽º»»¿¡¼­ Å×ÀÌºí¿¡¼­ ³»·Á Datafiles Á¦°ÅÇÏ°í °è¼ÓÀ» Àд ¹æ¹ý»

How to Backup and Restore (Export and Import) MySQL Databases Tutorial ¹é¾÷ ¹× º¹¿øÇÏ´Â ¹æ¹ý (³»º¸³»±â ¹× °¡Á®¿À±â)Àº MySQL µ¥ÀÌÅͺ£À̽º¸¦ ÀÚ½À¼­

Saturday, July 21st, 2007 Åä¿äÀÏ, 7 ¿ù 21, 2007

phpMyAdmin can be used to export or backup MySQL databases easily. phpMyAdminÀº ¼öÃâ ¶Ç´Â ¹é¾÷ÀÇ MySQL µ¥ÀÌÅͺ£À̽º¸¦ ½±°Ô »ç¿ëÇÒ ¼öÀÖ½À´Ï´Ù. However, if the database size is very big, it probably won¡¯t be a good idea. ±×·¯³ª µ¥ÀÌÅͺ£À̽ºÀÇ Å©±â°¡ ¸Å¿ì Å« °æ¿ì, ±×°Ç ¾Æ¸¶µµ ÁÁÀº »ý°¢µÇÁö ¾Ê½À´Ï´Ù. phpMyAdmin allows users to save database dump as file or display on screen, which involves exporting SQL statements from the server, and transmitting the data across slower network connection or Internet to user¡¯s computer. phpMyAdminÀº »ç¿ëÀÚ°¡ µ¥ÀÌÅͺ£À̽º¿¡ ÀúÀåÇÒ ¼öÀÖ´Â ÆÄÀÏ ¶Ç´Â È­¸é¿¡ Ç¥½ÃÇÏ´Â °æ¿ì, ¼­¹ö¿¡¼­ SQL°ú °ü·ÃµÈ Áø¼úÀ» ¼öÃâÇÏ°í ´À¸° ³×Æ®¿öÅ© ¿¬°á ¶Ç´Â »ç¿ëÀÚÀÇ ÄÄÇ»Å͸¦ ÀÎÅͳÝÀ» ÅëÇØ µ¥ÀÌÅ͸¦ Àü¼ÛÇÏ´Â ´ýÇÁ. This process slow the exporting process, increase database locking time and thus MySQL unavailability, slow the server and may simply crash the Apache HTTPD server if too many incoming web connections hogging the system¡¯s resources. ÀÌ °úÁ¤À», ±×¸®°í MySQLÀ» unavailability µû¶ó¼­, µ¥ÀÌÅͺ£À̽º ½Ã°£ Áõ°¡ Àá±Ý ¼öÃâ ÇÁ·Î¼¼½º ¼­¹ö°¡ ´À¸° ¼Óµµ¿Í °£´ÜÈ÷ ¾ÆÆÄÄ¡ httpd´Â ¼­¹ö¸¦ ³Ê¹« ¸¹ÀÌ µé¾î¿À´Â °æ¿ì À¥ Á¢¼Ó ½Ã½ºÅÛÀÇ ÀÚ¿ø hogging »ç°íÀÖ½À´Ï´Ù.

Continue reading How to Backup and Restore (Export and Import) MySQL Databases Tutorial » » » ¹é¾÷ ¹× º¹¿øÇÏ´Â ¹æ¹ýÀ» °è¼Ó Àбâ (³»º¸³»±â ¹× °¡Á®¿À±â)Àº MySQL µ¥ÀÌÅͺ£À̽º¸¦ ÀÚ½À¼­»»»


MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length MySQLÀÇ ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® ¿­¿¡ ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ëÇÒ

Monday, July 9th, 2007 ¿ù¿äÀÏ, 7 ¿ù 9, 2007

When creating a new table or altering an existing table with primary keys, unique constraints and indexes, or when defining a new index with Alter Table manipulation statement in MySQL database, the following error may occur and prohibit the the command from completing: »õ Å×À̺íÀ» ¸¸µé ¶§ ¶Ç´Â ±âº» Ű, °íÀ¯ Á¦¾à ¹× »öÀÎ »ý¼ºÇϰųª, MySQL µ¥ÀÌÅͺ£À̽º¿¡¼­ º¯°æµÇ¸é »õ »öÀΠǥ Á¶ÀÛ ¼º¸í°ú Á¤ÀÇ¿Í ±âÁ¸ Å×À̺íÀ» º¯°æ, ´ÙÀ½°ú °°Àº ¿À·ù°¡ ¹ß»ýÇÒ ¼ö ÀÖÀ¸¸ç ¿Ï·áÀ¸·ÎºÎÅÍ ±ÝÁö ¸í·É :

ERROR 1170 (42000): BLOB/TEXT column ¡®field_name¡¯ used in key specification without a key length ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® ¿­ÀÇ 'field_name'۸¦ »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë

Continue reading MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length » » » °è¼Ó Àбâ MySQLÀÇ ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® ¿­¿¡ ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀÌ»»»¾øÀÌ »ç¿ëÇÒ

Remove or Trim First or Last Few Characters in MySQL Database with SQL ¿ì¼± Æ®¸²À» Á¦°ÅÇϰųª ¶Ç´Â SQL¿Í MySQL µ¥ÀÌÅͺ£À̽º¿¡¼­ ¸¶Áö¸· ¸îÀÚ¸¦

Monday, April 23rd, 2007 ¿ù¿äÀÏ, 4 ¿ù 23, 2007

Another useful string function in MySQL database is TRIM() which will return a text string after removing the matching leading or trailing characters, also known as prefixes or suffixes. MySQL µ¥ÀÌÅͺ£À̽º¿¡ ¶Ç ´Ù¸¥ À¯¿ëÇÑ ±â´ÉÀ» À߶󳻱⠹®ÀÚ¿­ ()Àº ¸ÅĪ ¼±Çà ¶Ç´Â ÈÄÇà ¹®ÀÚ¸¦ Á¦°ÅÇÑ ÈÄ, Á¢µÎ»ç ȤÀº Á¢¹Ì»ç·Î ¾Ë·ÁÁø ¶ÇÇÑ ÅØ½ºÆ® ¹®ÀÚ¿­À» ¹ÝȯÇÑ´Ù. It¡¯s been described by MySQL reference as function that returns the string str with all remstr prefixes or suffixes removed. ±×°ÍÀ» ÇÔ¼ö·Î MySQLÀ» ÂüÁ¶ remstr Á¢µÎ»ç ¶Ç´Â Á¢¹Ì»ç¿Í ¹ÝȯÇÏ´Â ¸ðµç ¹®ÀÚ¿­ÀÇ Á¦°Å´Â str¿¡ ÀÇÇØ ¼³¸íµÇ°íÀÖ´Ù. If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. ÁöÁ¤ÇÏ´Â °æ¿ì¿¡´Â µÑ ´Ù ¼±µµ ¶Ç´Â ÈÄÇà ¸ðµÎ¿¡°Ô ¾Æ¹« »ý°¢ÀÔ´Ï´Ù. remstr is optional and, if not specified, spaces are removed. remstrÀº ¿É¼ÇÀ̸ç, ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸é °ø¹éÀÌ Á¦°ÅµË´Ï´Ù.

Continue reading Remove or Trim First or Last Few Characters in MySQL Database with SQL » » » °è¼Ó Àбâ Á¦°Å ¶Ç´Â ´Ùµë±â ù° ¶Ç´Â SQL»»»¿Í MySQL µ¥ÀÌÅͺ£À̽º¿¡¼­ ¸¶Áö¸· ¸îÀÚ¸¦

How to Find and Replace Text in MySQL Database using SQL ÅØ½ºÆ® ±³Ã¼ÇÏ´Â ¹æ¹ý°ú SQLÀ» »ç¿ëÇÏ¿© MySQL µ¥ÀÌÅͺ£À̽º¿¡¼­ ã±â

Monday, April 23rd, 2007 ¿ù¿äÀÏ, 4 ¿ù 23, 2007

MySQL database has a handy and simple string function REPLACE() that allows table data with the matching string (from_string) to be replaced by new string (to_string). MySQL µ¥ÀÌÅͺ£À̽º¿¡ Æí¸®ÇÑ ±â´É°ú °£´ÜÇÑ ¹®ÀÚ¿­ REPLACE ()Àº °Ë»ö ¹®ÀÚ¿­À» »õ ¹®ÀÚ¿­ (to_string)¿¡ ÀÇÇØ ´ëüµÉ ¼ö (from_string)¿Í ÇÔ²² Å×ÀÌºí¿¡ µ¥ÀÌÅ͸¦ÇÏ½Ç ¼öÀÖ½À´Ï´Ù. This is useful if there is need to search and replace a text string which affects many records or rows, such as change of company name, postcode, URL or spelling mistake. ÀÌ °æ¿ì¿¡´Â À¯¿ëÇÏ´Ù °Ë»öÇϰíÀÖ´Â ¸¹Àº ·¹ÄÚµå ¶Ç´Â Çà, ȸ»ç À̸§, ¿ìÆí ¹øÈ£, URL ¶Ç´Â ¸ÂÃã¹ý ½Ç¼öÀÇ º¯È­ µîÀÇ ¿µÇâÀ» ÅØ½ºÆ® ¹®ÀÚ¿­·Î ´ëÃ¼ÇØ¾ßÇÕ´Ï´Ù.

Continue reading How to Find and Replace Text in MySQL Database using SQL » » » ÅØ½ºÆ® ±³Ã¼ÇÏ´Â ¹æ¹ý ¹× MySQL µ¥ÀÌÅͺ£À̽º¿¡¼­ SQL»»»¸¦ »ç¿ëÇÏ¿© °è¼Ó µ¶¼­ ã±â

How to Escape Characters in Oracle PL/SQL Queries ¾î¶»°Ô ¿À¶óŬÀº PL / SQL Äõ¸®¿¡ µîÀåÇÏ´Â Àι°À» Å»ÃâÇÏ´Â

Saturday, March 24th, 2007 Åä¿äÀÏ, 3 ¿ù 24, 2007

Oracle databases reserve some special characters with specific meaning and purpose within Oracle environment. ¿À¶óŬÀº ¿À¶óŬ µ¥ÀÌÅͺ£À̽ºÀÇ ±¸Ã¼ÀûÀÎ ÀÇ¹Ì¿Í ¸ñÀûÀ» °¡Áø ȯ°æ ³»¿¡¼­ ÀϺΠƯ¼ö ¹®ÀÚ¸¦ º¸À¯ÇÕ´Ï´Ù. These reserved characters include _ (underscore) wild card character which used to match exactly one character, % (percentage) which used to match zero or more occurrences of any characters and ¡® (apostrophe or quotation mark) which used to mark the value supplied. ÀÌ·¯ÇÑ ¿¹¾à ¹®ÀÚ¸¦ Æ÷ÇÔ _ (¹ØÁÙ), '(¶Ç´Â ÀÎ¿ë ºÎÈ£)¿¡ ¾ÆÆ÷ ½ºÆ®·ÎÇÇ °¡Ä¡¸¦ Ç¥½ÃÇÏ´Â µ¥ »ç¿ëµÇ´Â ¸ðµç ¹®ÀÚÀÇ 0 °³ ÀÌ»óÀÇ »ç°ÇÀ» ÀÏÄ¡½ÃŰ´Â µ¥ »ç¿ë (ºñÀ²) % Á¤È®È÷ ÇϳªÀÇ ¹®ÀÚ¿Í ÀÏÄ¡ÇÏ´Â µ¥ »ç¿ëµÇ´Â ¿ÍÀϵå Ä«µå ¹®ÀÚ¸¦ °ø±ÞÇß´Ù. These special characters will not be interpreted literally when building SQL query in Oracle, and may caused error in results returned especially when performing string search with LIKE keyword. ÀÌ·¯ÇÑ Æ¯¼ö ¹®ÀÚ ±×´ë·Î ¿À¶óŬ¿¡¼­ SQL Äõ¸®¸¦ ±¸ÃàÇßÀ» ¶§, ±×¸®°í ÇØ¼®µÇÁö ¾Ê½À´Ï´Ù °á°ú¿¡ ¿À·ù°¡ ¹ß»ýÀÖ½À´Ï´Ù ¹®ÀÚ¿­ °Ë»öÀ» ¼öÇàÇÒ ¶§ ƯÈ÷ °°Àº Ű¿öµå·Î µ¹¾Æ¿Ô´Ù. To use these characters so that Oracle can interpret them literally as a part of string value instead of preset mean, escape character has to be assigned. ±×·¸°ÔÇÏ´Â ´ë½Å ¿À¶óŬÀº ¸» ±×´ë·Î ¹Ì¸® ¹®ÀÚ¿­ °ªÀÇ ÀÏºÎ·Î ÇØ¼®ÇÒ ¼öÀÖ´Â ¸»Àº ÀÌ·¯ÇÑ ¹®ÀÚ¸¦ »ç¿ëÇÏ·Á¸é, ¹®ÀÚ Å»ÃâÀ» ÇÒ´çÇÒ ¼öÀÖ´Ù.

Continue reading How to Escape Characters in Oracle PL/SQL Queries » » » °è¼Ó ÀÐ°í ¾î¶»°Ô ¿À¶óŬÀº PL / SQL Äõ¸®»»»¿¡¼­ ¹®ÀÚ¸¦ À̽ºÄÉÀÌÇÁ¸¦