Recent Entries 10
- snippet minor 112d agoHow to Avoid SQLPlus output truncatingI have the following column in oracle database table. ``` Column name : objectdata Data type : LONG RAW ``` When I query this column via sqlplus output is like below. ``` SQL> select objectdata from tableA where login_id = 'xxxxxxxx'; O - A ``` This should be actually ``` Objectdata ---------------------- ACED0005737200136A617661... (very long value) ``` I have tried `set long 10000` `SET PAGESIZE 32766` `SET LINESIZE 32766` etc. Still it shows as truncated. How to get this value without truncated?
- debug minor 112d agoCannot connect database as sys as sysdba using sqlplusI am new to oracle server 18c (currently taking online course). My problem is sql*plus where I tried to use sqlplus then sys as sysdba (it did not work) and the error appeared below. However, if I use sqlplus / as sysdba (it worked, and I don't know why) I have tried this command: lsnrctl start, but again not working. In addition, I have checked my listener.ora and tnsnames.oraca I have attached my environment set up in .bash_profile Please help me this. Thank you
- snippet minor 112d agoHow can I be specific about which CDB I want to connect to wrapping a PDB?I'm quite new to Oracle. I created a CDB like cdb1 and then a PDB within like pdb1. Now I can connect to my PDB using something like: `sqlplus user/password@server:port/pdb1` But can't I have two PDBs with the same name in different CDBs? If that happened, `sqlplus` wouldn't know which PDB I wanted to connect to. Does the listener have some robust way to map the PDB passed in the connection to an actual PDB within a CDB on the machine where the listener is running? EDIT: I found out that when I write `pdb1` in the `sqlplus` connection identifier, that is actually not the name of the PDB, but the name of the service, which just happens to be the same as the name of the PDB. As far as I understand, I can map the service name to PDB name using `select name, pdb from v$services;`. It seems to map services to CDBs I need to type `lsnrctl service`. And then I get output like: ``` Service "pdb1" has 1 instance(s). Instance "cdb1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER ``` So I guess the instance `cdb1` is referring to the CDB `cdb1`? Or does it also just happen to have the same name? Then again, surely the service stating that it has 1 instance, means it could have 2 instances and these could point to separate CDBs, which brings me back to my original question of how to differentiate different PDBs with the same name.
- pattern major 112d ago"ORA-24454: client host name is not set" when connecting from Ubuntu instance on AWS EC2Some background: I am attempting to connect to an Oracle database. I have a username, password, IP address, port, and service name. I only have access to this database from an Ubuntu EC2 instance on AWS because the Oracle database is located inside another organization. Due to this, I do not have access to a DNS hostname for this machine. I downloaded the "Oracle Instant Client with SQL Plus" client package from Oracle's website and extracted it to a folder. When I try to run it, I get this message: ORA-24454: client host name is not set
- pattern minor 112d agoSP2-0667: Message file sp1<lang>.msb not found sqlplus oracleI've a linux RedHat which contains oracle database. I setted all environnement variables, but when I running `sqlplus` command I've this error : `SP2-0667: Message file sp1.msb not found` Here are my variables ans my `sqlplus` commands : ``` [oracle@as ~]$ echo $ORACLE_HOME /oracle/product/12.1.0/dbhome_1 [oracle@as ~]$ echo $ORA_NLS33 /oracle/product/12.1.0/dbhome_1/nls/data [oracle@as ~]$ echo $LD_LIBRARY_PATH /oracle/product/12.1.0/dbhome_1/lib [oracle@as ~]$ sqlplus Error 6 initializing SQL*Plus SP2-0667: Message file sp1.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory ``` Note that I'm currently running as `oracle` user, which seems to be the owner of the `/oracle` folder with read and excecute permission. I also seen that a file named sp1us.msb exists in the following folder : ``` [oracle@as ~]$ find $ORACLE_HOME | grep sp1 /oracle/product/12.1.0/dbhome_1/sqlplus/mesg/sp1us.msb /oracle/product/12.1.0/dbhome_1/sqlplus/mesg/sp1us.msg ```
- pattern minor 112d agoHow in Oracle can I export package that will have package and body?I'm using putty. How in Oracle can I export package and its body to a file in present directory using spool? Thanks
- snippet minor 112d agoHow to create database/tablespace/schema and users for quickstart developers on Oracle 12?Background I need to create a contained development space for a new application. This requires a user account to connect with all permissions, such as create/drop tables and stored procedures. Following the principle of least privilege, all of the application's database operations will be wrapped in stored procedures, so another application user account is required with only execute permissions to those stored procedures (itemized in production; all in development). I've got a fresh Oracle 12c installation on Windows Server 2008 R2 Enterprise with available connections to what I think is called a database named 'orcl'. Now I can start sqlplus from cmd.exe ``` sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 8 09:49:03 2016 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> ``` How do I functionally accomplish the following? I've provided the MySQL console (`mysql -u root -p`) equivalent instructions under each of my requirements. - new database/schema created ``` CREATE DATABASE appdb; ``` - new dbo user created for DDL ``` CREATE USER 'appdb_owner'@'localhost' IDENTIFIED BY 'c0mpl3xpw0rd'; GRANT ALL PRIVILEGES ON appdb.* TO 'appdb_owner'@'localhost'; ``` - new test user for application execution ``` CREATE USER 'appdb_user'@'localhost' IDENTIFIED BY 'simplerpw0rd'; GRANT EXECUTE ON appdb.* TO 'appdb_user'@'localhost'; ``` Failures I'm very familiar with MySQL, but totally new to Oracle and sqlplus. I think some of my confusion stems from the distinction between a database, tablespace, and a schema from my lesser familiarity with DB2. From what I've seen on the 11.1 create database page, it looks unnecessarily complex (like a new installation) for what I'm trying to achieve, so I think what I am looking for instead is a new schema that will
- snippet moderate 112d agoHow to connect to oracle 12c from sqlplus without password in command lineThis may seem as weird question: If i have user called `demo` with password Pass1234 When connecting to oracle 11g I can run `sqlplus` like this with password in command line: on DB host: ``` C:\> sqlplus demo/Pass1234 ``` Or remote machine ``` C:\> sqlplus demo/Pass1234@:1521/orcl ``` I can do so without give the password in command line and expose it like this: ``` C:\> sqlplus demo ``` Then I get: ``` SQL*Plus: Release 11.1.0.7.0 bla bla bla Copyright (c) bla bla bla Enter password: ``` Then I can enter the password manually. When connecting to Oracle 12c I can connect like this from any machine (with password): ``` C:\> sqlplus demo/Pass1234@:1521/pdborcl ``` My question is: How to connect to Oracle 12c without `tnsnames.ora` edit and without write the password in the command line? I also havn't figured out yet if it is possible to connect to Oracle 12c from sqlplus on the DB host machine without give the IP or localhost, and without editing the tnsnames.ora, like I can do in Oracle 11g? And more thing, can I do so from a remote machine (even to Oracle 11g) without using a full connect? (means to give user and db connection in command line and password manually, not like use `/NOLOG` in command and then: `SQL> connect demo/Pass1234@:1521/pdborcl`) Thanks!
- pattern minor 112d agoSQLPLUS: SELECT INTO prompting for variable valueAny idea why this is prompting me for the value? I'm calling the script via batch file: ``` DECLARE precount NUMBER; nowcount NUMBER; BEGIN SELECT COUNT(*) INTO precount FROM PLAN_OFFER_BK_PRE_SCRIPT WHERE COV_IN = 'Y' AND PLAN_IN = 'Y'; SELECT COUNT(*) INTO nowcount FROM PLAN_OFFER WHERE COV_IN = 'Y' AND PLAN_IN = 'Y'; END; / -- NUMBER OF MEC/MVP RECORDS SPOOL logs\MVP_MEC_UPDATED.log APPEND PROMPT &&CLIENTID &&precount &&nowcount SPOOL OFF; ``` Thanks!
- snippet minor 112d agoHow can sqlplus knows where ORACLE_SID point?As I understand, `SID` is unique value to identify an Oracle database instance. And I can set default database instance `sqlplus` use by changing `ORACLE_SID` environment variable. But how can sqlplus know where the `SID` point? I have thought tnsnames.ora let sqlplus know the information but there seems not present that kind information. (If so when does sqlplus use tnsnames.ora?)