# Views | Script hangs or becomes blank

**URL:** <https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [July 14, 2015, 8:35am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758 "2015-07-14T08:35:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![eduliu](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@eduliu](https://forums.toadworld.com/u/eduliu)\
**Post date:** [July 14, 2015, 8:35am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/1 "2015-07-14T08:35:39Z")

</div>

When I try to display the script behind a view - i.e., click on the “Views | Script” tab, Toad would keep spinning. If I click on another tab, like “Data,” it would display the data without any issue. But when I click back to the “Script” tab, it would be blank. This only happens recently. What would be the cause? And any way to fix this? Thanks!

---

<div class="post-metadata">

**Author:** ![robert.moffett](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@robert.moffett](https://forums.toadworld.com/u/robert.moffett)\
**Post date:** [September 23, 2015, 6:42am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/2 "2015-09-23T06:42:11Z")

</div>

We’re getting the same thing except with roles only in 12.7.1.11 64bit talking to an 11.2.0.4 database. Everything is fine looking at a role until I hit the script tab. Then it spins up a CPU and won’t come back.

I had something similar happen a few versions ago and I think the problem was that it wasn’t detecting 11gr2 vs 12c correctly and trying to run 12c code instead of the 11gr2

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 23, 2015, 7:01am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/3 "2015-09-23T07:01:12Z")

</div>

Is this any role or a specific role?

when you say the CPU goes up and won’t come back, do you mean that the CPU never settles down or that it does settle down but the script is still blank?

If you turn on spool SQL (Main Menu -\> Database -\> Spool SQL -\> Spool to Screen) you can see what queries we are executing and if they have any errors.

---

<div class="post-metadata">

**Author:** ![robert.moffett](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@robert.moffett](https://forums.toadworld.com/u/robert.moffett)\
**Post date:** [September 23, 2015, 7:09am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/4 "2015-09-23T07:09:40Z")

</div>

Any role. Looking at spotlight, the query grabs a CPU and doesn’t let go, last SQL in the detail box is unhelpful. Here’s the last thing in the spool file:

Session: BANINST1@PROD

Timestamp: 10:07:27.225

BEGIN

SYS.DBMS\_APPLICATION\_INFO.SET\_MODULE(‘TOAD 12.7.1.11’, null);

END;

That doesn’t make sense to me.

This is the last query sent, and it seemed to complete just fine:

* * *

Session: BANINST1@PROD

Timestamp: 10:06:42.466

Select o.object\_type, pp.\*

from dba\_objects o,

(Select p.grantee, p.owner, p.table\_name, null column\_name, p.privilege, p.grantable

from dba\_tab\_privs p, dba\_roles r

where p.GRANTEE = r.role

and P.GRANTEE = :OneObjectName

UNION

Select p.grantee, p.owner, p.table\_name, p.column\_name, p.privilege, p.grantable

from dba\_col\_privs p, dba\_roles r

where p.GRANTEE = r.role

and P.GRANTEE = :OneObjectName

) pp

where o.OWNER = pp.owner

and o.object\_name = pp.table\_name

and o.object\_type in (‘TABLE’, ‘VIEW’, ‘SEQUENCE’, ‘PACKAGE’, ‘PROCEDURE’, ‘FUNCTION’, ‘SNAPSHOT’, ‘MATERIALIZED VIEW’, ‘DIRECTORY’, ‘LIBRARY’, ‘TYPE’, ‘OPERATOR’, ‘INDEXTYPE’, ‘EDITION’, ‘JOB’, ‘PROGRAM’, ‘SCHEDULE’)

order by pp.grantee, pp.owner, pp.table\_name, pp.column\_name

:OneObjectName(VARCHAR[9],IN)=‘DBFS\_ROLE’

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 23, 2015, 7:24am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/5 "2015-09-23T07:24:34Z")

</div>

That’s the query we use to determine object privileges that were granted to the role. If it shows up in the spool sql output, then execution of the query has finished, but all rows may or may not have been fetched.

So it’s the CPU on the server that’s shooting up? At first, I thought you meant on the client. If it’s the server CPU that is going up, it seems like Oracle is having to do a lot of work execute the query and complete the fetch requests.

If you try that query in the editor (setting the value for the variable), does it run quickly and can you scroll down to fetch all rows?

---

<div class="post-metadata">

**Author:** ![robert.moffett](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@robert.moffett](https://forums.toadworld.com/u/robert.moffett)\
**Post date:** [September 23, 2015, 7:31am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/6 "2015-09-23T07:31:45Z")

</div>

Yes, the CPU spike is on the server, and no, that code is not finishing, 3 minutes and counting, no rows returned yet. I re-gathered fixed object stats just in case something got out of hand.

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 23, 2015, 7:37am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/7 "2015-09-23T07:37:18Z")

</div>

Try re-gathering data dictionary stats. That’s what we’re querying against here. You may want different options, but the script should look something like this:

BEGIN

SYS.DBMS\_STATS.GATHER\_DICTIONARY\_STATS (

Granularity =\> ‘DEFAULT’

,Options =\> ‘GATHER’

,Estimate\_Percent =\> SYS.DBMS\_STATS.AUTO\_SAMPLE\_SIZE

,Method\_Opt =\> ‘FOR ALL COLUMNS SIZE 1’

,Degree =\> SYS.DBMS\_STATS.DEFAULT\_DEGREE

,Cascade =\> FALSE

,No\_Invalidate =\> FALSE);

END;

/

---

<div class="post-metadata">

**Author:** ![robert.moffett](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@robert.moffett](https://forums.toadworld.com/u/robert.moffett)\
**Post date:** [September 23, 2015, 8:25am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/8 "2015-09-23T08:25:16Z")

</div>

That would have been cool if it would have worked. I did run the query through the Oracle tuning advisor (OEM) and accepted a plan that works. I don’t know what setting would cause the optimizer not to be able to choose the correct plan, but it works now.

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 23, 2015, 8:28am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/9 "2015-09-23T08:28:05Z")

</div>

It doesn’t always work, but I think it’s a required step when this kind of thing happens. Glad you got it working. Oracle Tuning Advisor was the next thing I was going to suggest. 🙂

---

<div class="post-metadata">

**Author:** ![robert.moffett](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@robert.moffett](https://forums.toadworld.com/u/robert.moffett)\
**Post date:** [September 23, 2015, 8:31am UTC](https://forums.toadworld.com/t/views-script-hangs-or-becomes-blank/33758/10 "2015-09-23T08:31:11Z")

</div>

I think I’m running into a problem with vendor supplied undocumented parameters required for their application because of some specific bugs. Some of these are quite old, so I’m checking to see if they can be safely removed now. Thanks for the help!
