Advertisement
ExaGridDba

load WE8MSWIN1252 chars into 12c ASCII database (contrived)

Feb 1st, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ASCII -sid ASCII -responseFile NO_VALUE -storageType ASM -diskGroupName DATA -characterSet US7ASCII -memoryPercentage 20 -emConfiguration LOCAL -sampleSchema FALSE
  2.  
  3. [oracle@waipio1 ASCII]$ cat  ASCII.LOG
  4.  
  5. UNIQUE DATABASE identifier CHECK passed.
  6.  
  7. +DATA has enough SPACE. Required SPACE IS 6470 MB , available SPACE IS 23011 MB.
  8. FILE Validations SUCCESSFUL.
  9. Copying DATABASE files
  10. DBCA_PROGRESS : 1%
  11. DBCA_PROGRESS : 3%
  12. etc.
  13. DBCA_PROGRESS : 96%
  14. DBCA_PROGRESS : 100%
  15. DATABASE creation complete. FOR details CHECK the logfiles AT:     
  16.  /app/oracle/cfgtoollogs/dbca/ASCII.
  17. DATABASE Information:
  18. Global DATABASE Name:ASCII
  19. SYSTEM Identifier(SID):ASCII
  20.  
  21. The script:
  22. #!/bin/ksh
  23.  
  24. export NLS_LANG=.WE8MSWIN1252
  25.  
  26. sqlplus -s win/win <<-EOF
  27. SET linesize 200
  28. SET trimspool ON
  29. SET pagesize 0
  30. SET feedback off
  31.  
  32. spool quantumext.dat
  33. SELECT q'{Bose}' || UNISTR('\2013') || q'{Einstein}' val FROM dual;
  34. spool off
  35.  
  36. quit
  37.  
  38. EOF
  39. unset NLS_LANG
  40.  
  41. sqlplus win/win <<-EOF
  42.  
  43. CREATE DIRECTORY quant AS '/home/oracle/sql/characterset';
  44.  
  45. CREATE TABLE quantumext (
  46.         stattype VARCHAR2 ( 13 CHAR )
  47.         )
  48.         ORGANIZATION external
  49.         (TYPE oracle_loader
  50.          DEFAULT DIRECTORY quant
  51.          ACCESS parameters
  52.          (
  53.           records delimited BY newline
  54.           badfile 'quantumext.bad'
  55.           discardfile 'quantumext.dis'
  56.           logfile 'quantumext.log'
  57.           fields terminated BY ","  optionally enclosed BY '"'
  58.           (
  59.            stattype        CHAR(25)
  60.           )
  61.          )
  62.          location ('quantumext.dat')
  63.         )
  64.         ;
  65.  
  66. CREATE TABLE quantumstats (
  67.         stattype VARCHAR2 ( 13 CHAR )
  68.         );
  69. INSERT INTO quantumstats SELECT stattype FROM quantumext;
  70.  
  71. COMMIT;
  72. SELECT DUMP( stattype ) FROM quantumstats;
  73.  
  74. -- drop table quantumstats;
  75. DROP TABLE quantumext;
  76. DROP DIRECTORY quant;
  77. EOF
  78.  
  79.  
  80.  
  81. [oracle@waipio1 ASCII characterset]$ ./INSERT.win.chars.ksh
  82. BoseEinstein
  83.  
  84. SQL*Plus: RELEASE 12.1.0.1.0 Production ON Sat Feb 1 21:45:41 2014
  85.  
  86. Copyright (c) 1982, 2013, Oracle.  ALL rights reserved.
  87.  
  88. LAST SUCCESSFUL login TIME: Sat Feb 01 2014 21:45:41 -05:00
  89.  
  90. Connected TO:
  91. Oracle DATABASE 12c Enterprise Edition RELEASE 12.1.0.1.0 - 64bit Production
  92. WITH the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
  93. AND REAL Application Testing options
  94.  
  95. SQL> SQL>
  96. DIRECTORY created.
  97.  
  98. SQL> SQL>   2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20
  99. TABLE created.
  100.  
  101. SQL> SQL>   2    3
  102. TABLE created.
  103.  
  104. SQL>
  105. 1 ROW created.
  106.  
  107. SQL> SQL>
  108. COMMIT complete.
  109.  
  110. SQL>
  111. DUMP(STATTYPE)
  112. --------------------------------------------------------------------------------
  113. Typ=1 Len=13: 66,111,115,101,150,69,105,110,115,116,101,105,110
  114.  
  115. SQL> SQL> SQL>
  116. TABLE dropped.
  117.  
  118. SQL>
  119. DIRECTORY dropped.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement