# Oracledb\_session query problem

**URL:** <https://discourse.chef.io/t/oracledb-session-query-problem/14754>\
**Category:** Chef InSpec\
**Created:** [March 18, 2019, 6:27pm UTC](https://discourse.chef.io/t/oracledb-session-query-problem/14754 "2019-03-18T18:27:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maychar](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@maychar](https://discourse.chef.io/u/maychar)\
**Post date:** [March 18, 2019, 6:27pm UTC](https://discourse.chef.io/t/oracledb-session-query-problem/14754/1 "2019-03-18T18:27:26Z")

</div>

ok I know this is probably a dumb question, but I'm attempting to do a simple query of the v$database table and it appears it is failing because of the '$' character. I just do not know how to escape this character because the \ does not work. I'm very new to inspec and not sure if it is some issue with how I'm connecting that is causing this issue since the oracledb\_session reference does not appear to treat this v$database with any special requirements.

example.rb:  
sql = oracledb\_session(as\_os\_user: 'oracle', as\_db\_role: 'sysdba', service: 'myservice', sqlplus\_bin: '/u01/app/oracle/product/12.1.0/dbhome\_1/bin/sqlplus')

describe sql.query("SELECT name from v$database;").row(0).column('name') do  
its('value') { should cmp 'ORCL' }  
end

output:  
Could not execute the sql query  
SQL\*Plus: Release 12.1.0.2.0 Production on Mon Mar 18 18:23:18 2019

Copyright (c) 1982, 2014, Oracle. All rights reserved.

I've read and consent to the terms in IS user agreem't.

Connected to:  
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production  
With the Partitioning and Unified Auditing options

SQL\> SQL\>   
  
SQL\>   
  
SQL\>

```
SELECT name from v
                 *
```

ERROR at line 1:  
  
  
ORA-00942: table or view does not exist

SQL\>   
  
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production  
With the Partitioning and Unified Auditing options

Profile: InSpec Profile (my\_nginx)  
Version: 0.1.0  
Target: local://

File /tmp  
✔ should be directory  
SQL Column  
× value should cmp == "ORCL"

```
 expected: "ORCL"
      got: ""

 (compared using `cmp` matcher)

```

Test Summary: 1 successful, 1 failure, 0 skipped

---

<div class="post-metadata">

**Author:** ![maychar](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@maychar](https://discourse.chef.io/u/maychar)\
**Post date:** [March 25, 2019, 7:27pm UTC](https://discourse.chef.io/t/oracledb-session-query-problem/14754/3 "2019-03-25T19:27:43Z")

</div>

it would appear that when using oracledb\_session with the as\_os\_user you need to provide 4 backslashes before the $. so `v\\\\$database` works
